[
  {
    "path": ".github/FUNDING.yml",
    "content": "github: [broofa, ctavan]\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.yml",
    "content": "name: Bug report\ndescription: File a bug against the `uuid` project\nlabels: ['bug']\ntitle: '[BUG] <title>'\n\nbody:\n  - type: checkboxes\n    attributes:\n      label: Before you begin...\n      options:\n        - label: I have searched the existing issues\n          required: true\n        - label: My issue title is descriptive and specific to the problem (i.e. search-engine friendly)\n          required: true\n        - label: I understand what an \"MRE\" is, and why providing one is important.  (If not, [read this](https://stackoverflow.com/help/minimal-reproducible-example))\n          required: true\n\n  - type: textarea\n    attributes:\n      label: MRE and Description\n      description: '**IMPORTANT**: Failure to provide an MRE is likely to result in your issue being closed without comment.'\n    validations:\n      required: false\n\n  - type: textarea\n    attributes:\n      label: Environment\n      description: 'Output of `npx envinfo --system --browsers --npmPackages --binaries` goes here:'\n    validations:\n      required: false\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.yml",
    "content": "name: Feature request\ndescription: Suggest an idea for this project\nlabels: ['feature']\n\nbody:\n  - type: textarea\n    attributes:\n      label: Feature description\n\n  - type: textarea\n    attributes:\n      label: Additional information\n      description: E.g. alternatives you've considered, examples, screenshots, or anything else that may be helpful\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "<!--\nThank you for your contribution!\n\nIf your pull request contains considerable changes please run the benchmark before and after your\nchanges and include the results in the pull request description. To run the benchmark execute:\n\n    npm run test:benchmark\n\nfrom the root of this repository.\n-->\n"
  },
  {
    "path": ".github/SECURITY.md",
    "content": "For issues related to `uuid` security please email the module maintainers. Their email addresses are available via `npm owner ls uuid`.\n"
  },
  {
    "path": ".github/workflows/browser.yml",
    "content": "name: Browser\n\non:\n  workflow_dispatch:\n  push:\n  pull_request_target:\n    types: [labeled]\n\npermissions:\n  contents: read\n\nenv:\n  HUSKY: 0\n\njobs:\n  browser:\n    if: github.repository == 'uuidjs/uuid' && (contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push')\n    runs-on: ubuntu-latest\n    timeout-minutes: 30\n\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 10\n      - name: Use Node.js 20.x\n        uses: actions/setup-node@v4\n        with:\n          node-version: 20.x\n      - run: npm ci\n      - name: Test Browser\n        run: npm run test:browser\n        env:\n          CI: true\n          BROWSERSTACK_USER: ${{ secrets.BROWSERSTACK_USER }}\n          BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}\n      - run: npx bundlewatch --config bundlewatch.config.json\n        env:\n          BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\n\non: [push, pull_request]\n\npermissions:\n  contents: read\n\nenv:\n  HUSKY: 0\n\njobs:\n  lint:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - name: Use Node.js\n        uses: actions/setup-node@v4\n        with:\n          node-version: 24.x\n\n      - run: npm ci\n      - run: npm run lint\n      - run: npm run docs:diff\n\n  test:\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        node-version: [18.x, 20.x, 22.x, 24.x]\n    steps:\n      - uses: actions/checkout@v4\n      - name: Use Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v4\n        with:\n          node-version: ${{ matrix.node-version }}\n          cache: npm\n\n      - run: npm ci\n      - run: npm run test\n      - run: npm run test:node\n"
  },
  {
    "path": ".github/workflows/release-please.yml",
    "content": "# Relevent docs:\n# - https://github.com/googleapis/release-please\n# - https://github.com/googleapis/release-please-action\n\non:\n  workflow_dispatch:\n\n  push:\n    branches:\n      - main\n\npermissions:\n  contents: write\n  id-token: write\n  pull-requests: write\n\nname: release-please\n\njobs:\n  release-please:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: googleapis/release-please-action@v4\n        id: release\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          release-type: node\n\n      - run: echo \"Release created?... ${{ steps.release.outputs.release_created }}\"\n\n      # Steps below handle publication to NPM\n      - uses: actions/checkout@v4\n        if: ${{ steps.release.outputs.release_created }}\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 24\n          registry-url: 'https://registry.npmjs.org'\n        if: ${{ steps.release.outputs.release_created }}\n\n      - run: npm ci\n        if: ${{ steps.release.outputs.release_created }}\n\n      - run: npm test\n        if: ${{ steps.release.outputs.release_created }}\n\n      - run: npm publish --provenance\n        if: ${{ steps.release.outputs.release_created }}\n"
  },
  {
    "path": ".github/workflows/stale-issues.yml",
    "content": "name: Close inactive issues\non:\n  schedule:\n    - cron: '45 2 * * *'\n\njobs:\n  close-issues:\n    runs-on: ubuntu-latest\n    permissions:\n      issues: write\n      pull-requests: write\n    steps:\n      - uses: actions/stale@v7\n        with:\n          close-issue-message: 'Closing issue due to 30 days since being marked as stale.'\n          days-before-issue-close: 30\n          days-before-issue-stale: 90\n          days-before-pr-close: -1\n          days-before-pr-stale: -1\n          exempt-issue-labels: 'stale-exempt'\n          exempt-pr-labels: 'stale-exempt'\n          repo-token: ${{ secrets.GITHUB_TOKEN }}\n          stale-issue-label: 'stale'\n          stale-issue-message: 'Marking as stale due to 90 days with no activity.'\n"
  },
  {
    "path": ".gitignore",
    "content": "*.tgz\nbrowserstack.err\ndist/\ndist-*/\n.build/\nlocal.log\nlogs/\nnode_modules/\nexamples/**/package-lock.json\n"
  },
  {
    "path": ".husky/commit-msg",
    "content": "#!/bin/sh\nnpx --no-install commitlint --edit $1\n"
  },
  {
    "path": ".husky/pre-commit",
    "content": "npx --no-install lint-staged\n"
  },
  {
    "path": ".npmrc",
    "content": "tag-version-prefix=\"v\"\nsave-prefix=\"\"\n"
  },
  {
    "path": ".prettierignore",
    "content": "dist/\nnode_modules/\nREADME.md\nCHANGELOG.md\n*.sh\n.gitignore\n.prettierignore\n.husky\n"
  },
  {
    "path": ".vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"dbaeumer.vscode-eslint\",\n    \"ms-vscode.vscode-typescript-next\",\n    \"esbenp.prettier-vscode\"\n  ]\n}\n"
  },
  {
    "path": ".vscode/tasks.json",
    "content": "{\n  \"version\": \"2.0.0\",\n  \"tasks\": [\n    {\n      \"label\": \"Build watcher\",\n      \"group\": \"build\",\n      \"type\": \"shell\",\n      \"command\": \"npm run build:watch\",\n      \"runOptions\": {\n        \"runOn\": \"folderOpen\"\n      }\n    },\n    {\n      \"label\": \"Test watcher\",\n      \"group\": \"build\",\n      \"type\": \"shell\",\n      \"command\": \"npm run test:watch\",\n      \"windows\": {\n        \"command\": \"npm run test:watch\"\n      },\n      \"presentation\": {\n        \"reveal\": \"always\",\n        \"panel\": \"new\"\n      },\n      \"runOptions\": {\n        \"runOn\": \"folderOpen\"\n      }\n    }\n  ]\n}\n"
  },
  {
    "path": "AUTHORS",
    "content": "Robert Kieffer <robert@broofa.com>\nChristoph Tavan <dev@tavan.de>\nAJ ONeal <coolaj86@gmail.com>\nVincent Voyer <vincent@zeroload.net>\nRoman Shtylman <shtylman@gmail.com>\nPatrick McCarren <patrick@cumulative.io>\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Change Log\n\n## [13.0.0](https://github.com/uuidjs/uuid/compare/v12.0.0...v13.0.0) (2025-09-08)\n\n\n### ⚠ BREAKING CHANGES\n\n* make browser exports the default ([#901](https://github.com/uuidjs/uuid/issues/901))\n\n### Bug Fixes\n\n* make browser exports the default ([#901](https://github.com/uuidjs/uuid/issues/901)) ([bce9d72](https://github.com/uuidjs/uuid/commit/bce9d72a3ae5b9a3dcd8eb21ef6d1820288a427a))\n\n## [12.0.0](https://github.com/uuidjs/uuid/compare/v11.1.0...v12.0.0) (2025-09-05)\n\n\n### ⚠ BREAKING CHANGES\n\n* update to typescript@5.2 ([#887](https://github.com/uuidjs/uuid/issues/887))\n* remove CommonJS support ([#886](https://github.com/uuidjs/uuid/issues/886))\n* drop node@16 support ([#883](https://github.com/uuidjs/uuid/issues/883))\n\n### Features\n\n* add node@24 to ci matrix ([#879](https://github.com/uuidjs/uuid/issues/879)) ([42b6178](https://github.com/uuidjs/uuid/commit/42b6178aa21a593257f0a72abacd220f0b7b8a92))\n* drop node@16 support ([#883](https://github.com/uuidjs/uuid/issues/883)) ([0f38cf1](https://github.com/uuidjs/uuid/commit/0f38cf10366ab074f9328ae2021eea04d5f2e530))\n* remove CommonJS support ([#886](https://github.com/uuidjs/uuid/issues/886)) ([ae786e2](https://github.com/uuidjs/uuid/commit/ae786e27265f50bcf7cead196c29f1869297c42f))\n* update to typescript@5.2 ([#887](https://github.com/uuidjs/uuid/issues/887)) ([c7ee405](https://github.com/uuidjs/uuid/commit/c7ee40598ed78584d81ab78dffded9fe5ff20b01))\n\n\n### Bug Fixes\n\n* improve v4() performance ([#894](https://github.com/uuidjs/uuid/issues/894)) ([5fd974c](https://github.com/uuidjs/uuid/commit/5fd974c12718c8848035650b69b8948f12ace197))\n* restore node: prefix ([#889](https://github.com/uuidjs/uuid/issues/889)) ([e1f42a3](https://github.com/uuidjs/uuid/commit/e1f42a354593093ba0479f0b4047dae82d28c507))\n\n## [11.1.0](https://github.com/uuidjs/uuid/compare/v11.0.5...v11.1.0) (2025-02-19)\n\n\n### Features\n\n* update TS types to allow`Uint8Array` subtypes for `buffer` option ([#865](https://github.com/uuidjs/uuid/issues/865)) ([a5231e7](https://github.com/uuidjs/uuid/commit/a5231e7e1b98c20b23c35402a232167f476b39a2))\n\n## [11.0.5](https://github.com/uuidjs/uuid/compare/v11.0.4...v11.0.5) (2025-01-09)\n\n\n### Bug Fixes\n\n* add TS unit test, pin to typescript@5.0.4 ([#860](https://github.com/uuidjs/uuid/issues/860)) ([24ac2fd](https://github.com/uuidjs/uuid/commit/24ac2fd067e5bab97a5ccea3f6f365a64c01d140))\n\n## [11.0.4](https://github.com/uuidjs/uuid/compare/v11.0.3...v11.0.4) (2025-01-05)\n\n\n### Bug Fixes\n\n* **docs:** insure -&gt; ensure ([#843](https://github.com/uuidjs/uuid/issues/843)) ([d2a61e1](https://github.com/uuidjs/uuid/commit/d2a61e154d861e58549466e753bb9e4d5bfffb68))\n* exclude tests from published package ([#840](https://github.com/uuidjs/uuid/issues/840)) ([f992ff4](https://github.com/uuidjs/uuid/commit/f992ff4780937089b0134195fa22e76e2e1cb3a7))\n* Test for invalid byte array sizes and ranges in `v1()`, `v4()`, and `v7()` ([#845](https://github.com/uuidjs/uuid/issues/845)) ([e0ee900](https://github.com/uuidjs/uuid/commit/e0ee90051ebd13475bbcff4d371330aa4f9bd1dd))\n\n## [11.0.3](https://github.com/uuidjs/uuid/compare/v11.0.2...v11.0.3) (2024-11-04)\n\n\n### Bug Fixes\n\n* apply stricter typing to the v* signatures ([#831](https://github.com/uuidjs/uuid/issues/831)) ([c2d3fed](https://github.com/uuidjs/uuid/commit/c2d3fed22cfd47c22c8f22f6154abb5060648ce5))\n* export internal uuid types ([#833](https://github.com/uuidjs/uuid/issues/833)) ([341edf4](https://github.com/uuidjs/uuid/commit/341edf444ced63708ba336285dbec29443523939))\n* remove sourcemaps ([#827](https://github.com/uuidjs/uuid/issues/827)) ([b93ea10](https://github.com/uuidjs/uuid/commit/b93ea101af7382053032d4fb61cc85599d6c7216))\n* revert \"simplify type for v3 and v5\" ([#835](https://github.com/uuidjs/uuid/issues/835)) ([e2dee69](https://github.com/uuidjs/uuid/commit/e2dee691e95aba854a892d2507d8cd9f009bf61d))\n\n## [11.0.2](https://github.com/uuidjs/uuid/compare/v11.0.1...v11.0.2) (2024-10-28)\n\n### Bug Fixes\n\n* remove wrapper.mjs ([#822](https://github.com/uuidjs/uuid/issues/822)) ([6683ad3](https://github.com/uuidjs/uuid/commit/6683ad38b048375b451eac1194960f24ba20e0ca))\n\n## [11.0.1](https://github.com/uuidjs/uuid/compare/v11.0.0...v11.0.1) (2024-10-27)\n\n### Bug Fixes\n\n* restore package.json#browser field ([#817](https://github.com/uuidjs/uuid/issues/817)) ([ae8f386](https://github.com/uuidjs/uuid/commit/ae8f38657bca0ee053bf29c88c006b1ea05af1b5))\n\n## [11.0.0](https://github.com/uuidjs/uuid/compare/v9.0.0...v11.0.0) (2024-10-26)\n\n### ⚠ BREAKING CHANGES\n\n- refactor v1 internal state and options logic ([#780](https://github.com/uuidjs/uuid/issues/780))\n- refactor v7 internal state and options logic, fixes [#764](https://github.com/uuidjs/uuid/issues/764) ([#779](https://github.com/uuidjs/uuid/issues/779))\n- Port to TypeScript, closes [#762](https://github.com/uuidjs/uuid/issues/762) ([#763](https://github.com/uuidjs/uuid/issues/763))\n- update node support matrix (only support node 16-20) ([#750](https://github.com/uuidjs/uuid/issues/750))\n\n### Features\n\n- Port to TypeScript, closes [#762](https://github.com/uuidjs/uuid/issues/762) ([#763](https://github.com/uuidjs/uuid/issues/763)) ([1e0f987](https://github.com/uuidjs/uuid/commit/1e0f9870db864ca93f7a69db0d468b5e1b7605e7))\n- update node support matrix (only support node 16-20) ([#750](https://github.com/uuidjs/uuid/issues/750)) ([883b163](https://github.com/uuidjs/uuid/commit/883b163b9ab9d6655bfbd8a35e61a3c71674dfe1))\n\n### Bug Fixes\n\n- missing v7 expectations in browser spec ([#751](https://github.com/uuidjs/uuid/issues/751)) ([f54a866](https://github.com/uuidjs/uuid/commit/f54a866cedb2b3b96581157c1f4ac935a0b11411))\n- refactor v1 internal state and options logic ([#780](https://github.com/uuidjs/uuid/issues/780)) ([031b3d3](https://github.com/uuidjs/uuid/commit/031b3d3d738bc6694501ac0a37152b95ed500989))\n- refactor v7 internal state and options logic, fixes [#764](https://github.com/uuidjs/uuid/issues/764) ([#779](https://github.com/uuidjs/uuid/issues/779)) ([9dbd1cd](https://github.com/uuidjs/uuid/commit/9dbd1cd4177c43fcaac961a3b16fb2d044c9940a))\n- remove v4 options default assignment preventing native.randomUUID from being used ([#786](https://github.com/uuidjs/uuid/issues/786)) ([afe6232](https://github.com/uuidjs/uuid/commit/afe62323c4408a824755a39d7b971a8ae06f7199)), closes [#763](https://github.com/uuidjs/uuid/issues/763)\n- seq_hi shift for byte 6 ([#775](https://github.com/uuidjs/uuid/issues/775)) ([1d532ca](https://github.com/uuidjs/uuid/commit/1d532ca374f181932a24a83fa98f71a5bd4f3e96))\n- tsconfig module type ([#778](https://github.com/uuidjs/uuid/issues/778)) ([7eff835](https://github.com/uuidjs/uuid/commit/7eff835cba334ad418f57768c00d15b918a9b419))\n\n## [10.0.0](https://github.com/uuidjs/uuid/compare/v9.0.0...v10.0.0) (2024-06-07)\n\n### ⚠ BREAKING CHANGES\n\n- update node support (drop node@12, node@14, add node@20) (#750)\n\n### Features\n\n- support support rfc9562 MAX uuid (new in RFC9562) ([#714](https://github.com/uuidjs/uuid/issues/714)) ([0385cd3](https://github.com/uuidjs/uuid/commit/0385cd3f18ae9920678b2849932fa7a9d9aee7d0))\n- support rfc9562 v6 uuids ([#754](https://github.com/uuidjs/uuid/issues/754)) ([c4ed13e](https://github.com/uuidjs/uuid/commit/c4ed13e7159d87c9e42a349bdd9dc955f1af46b6))\n- support rfc9562 v7 uuids ([#681](https://github.com/uuidjs/uuid/issues/681)) ([db76a12](https://github.com/uuidjs/uuid/commit/db76a1284760c441438f50a57924b322dae08891))\n- update node support matrix (only support node 16-20) ([#750](https://github.com/uuidjs/uuid/issues/750)) ([883b163](https://github.com/uuidjs/uuid/commit/883b163b9ab9d6655bfbd8a35e61a3c71674dfe1))\n- support rfc9562 v8 uuids ([#759](https://github.com/uuidjs/uuid/issues/759)) ([35a5342](https://github.com/uuidjs/uuid/commit/35a53428202657e402e6b4aa68f56c08194541bf))\n\n### Bug Fixes\n\n- revert \"perf: remove superfluous call to toLowerCase ([#677](https://github.com/uuidjs/uuid/issues/677))\" ([#738](https://github.com/uuidjs/uuid/issues/738)) ([e267b90](https://github.com/uuidjs/uuid/commit/e267b9073df1d0ce119ee53c0487fe76acb2be37))\n\n## [9.0.1](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1) (2023-09-12)\n\n### build\n\n- Fix CI to work with Node.js 20.x\n\n## [9.0.0](https://github.com/uuidjs/uuid/compare/v8.3.2...v9.0.0) (2022-09-05)\n\n### ⚠ BREAKING CHANGES\n\n- Drop Node.js 10.x support. This library always aims at supporting one EOLed LTS release which by this time now is 12.x which has reached EOL 30 Apr 2022.\n\n- Remove the minified UMD build from the package.\n\n  Minified code is hard to audit and since this is a widely used library it seems more appropriate nowadays to optimize for auditability than to ship a legacy module format that, at best, serves educational purposes nowadays.\n\n  For production browser use cases, users should be using a bundler. For educational purposes, today's online sandboxes like replit.com offer convenient ways to load npm modules, so the use case for UMD through repos like UNPKG or jsDelivr has largely vanished.\n\n- Drop IE 11 and Safari 10 support. Drop support for browsers that don't correctly implement const/let and default arguments, and no longer transpile the browser build to ES2015.\n\n  This also removes the fallback on msCrypto instead of the crypto API.\n\n  Browser tests are run in the first supported version of each supported browser and in the latest (as of this commit) version available on Browserstack.\n\n### Features\n\n- optimize uuid.v1 by 1.3x uuid.v4 by 4.3x (430%) ([#597](https://github.com/uuidjs/uuid/issues/597)) ([3a033f6](https://github.com/uuidjs/uuid/commit/3a033f6bab6bb3780ece6d645b902548043280bc))\n- remove UMD build ([#645](https://github.com/uuidjs/uuid/issues/645)) ([e948a0f](https://github.com/uuidjs/uuid/commit/e948a0f22bf22f4619b27bd913885e478e20fe6f)), closes [#620](https://github.com/uuidjs/uuid/issues/620)\n- use native crypto.randomUUID when available ([#600](https://github.com/uuidjs/uuid/issues/600)) ([c9e076c](https://github.com/uuidjs/uuid/commit/c9e076c852edad7e9a06baaa1d148cf4eda6c6c4))\n\n### Bug Fixes\n\n- add Jest/jsdom compatibility ([#642](https://github.com/uuidjs/uuid/issues/642)) ([16f9c46](https://github.com/uuidjs/uuid/commit/16f9c469edf46f0786164cdf4dc980743984a6fd))\n- change default export to named function ([#545](https://github.com/uuidjs/uuid/issues/545)) ([c57bc5a](https://github.com/uuidjs/uuid/commit/c57bc5a9a0653273aa639cda9177ce52efabe42a))\n- handle error when parameter is not set in v3 and v5 ([#622](https://github.com/uuidjs/uuid/issues/622)) ([fcd7388](https://github.com/uuidjs/uuid/commit/fcd73881692d9fabb63872576ba28e30ff852091))\n- run npm audit fix ([#644](https://github.com/uuidjs/uuid/issues/644)) ([04686f5](https://github.com/uuidjs/uuid/commit/04686f54c5fed2cfffc1b619f4970c4bb8532353))\n- upgrading from uuid3 broken link ([#568](https://github.com/uuidjs/uuid/issues/568)) ([1c849da](https://github.com/uuidjs/uuid/commit/1c849da6e164259e72e18636726345b13a7eddd6))\n\n### build\n\n- drop Node.js 8.x from babel transpile target ([#603](https://github.com/uuidjs/uuid/issues/603)) ([aa11485](https://github.com/uuidjs/uuid/commit/aa114858260402107ec8a1e1a825dea0a259bcb5))\n- drop support for legacy browsers (IE11, Safari 10) ([#604](https://github.com/uuidjs/uuid/issues/604)) ([0f433e5](https://github.com/uuidjs/uuid/commit/0f433e5ec444edacd53016de67db021102f36148))\n\n- drop node 10.x to upgrade dev dependencies ([#653](https://github.com/uuidjs/uuid/issues/653)) ([28a5712](https://github.com/uuidjs/uuid/commit/28a571283f8abda6b9d85e689f95b7d3ee9e282e)), closes [#643](https://github.com/uuidjs/uuid/issues/643)\n\n### [8.3.2](https://github.com/uuidjs/uuid/compare/v8.3.1...v8.3.2) (2020-12-08)\n\n### Bug Fixes\n\n- lazy load getRandomValues ([#537](https://github.com/uuidjs/uuid/issues/537)) ([16c8f6d](https://github.com/uuidjs/uuid/commit/16c8f6df2f6b09b4d6235602d6a591188320a82e)), closes [#536](https://github.com/uuidjs/uuid/issues/536)\n\n### [8.3.1](https://github.com/uuidjs/uuid/compare/v8.3.0...v8.3.1) (2020-10-04)\n\n### Bug Fixes\n\n- support expo>=39.0.0 ([#515](https://github.com/uuidjs/uuid/issues/515)) ([c65a0f3](https://github.com/uuidjs/uuid/commit/c65a0f3fa73b901959d638d1e3591dfacdbed867)), closes [#375](https://github.com/uuidjs/uuid/issues/375)\n\n## [8.3.0](https://github.com/uuidjs/uuid/compare/v8.2.0...v8.3.0) (2020-07-27)\n\n### Features\n\n- add parse/stringify/validate/version/NIL APIs ([#479](https://github.com/uuidjs/uuid/issues/479)) ([0e6c10b](https://github.com/uuidjs/uuid/commit/0e6c10ba1bf9517796ff23c052fc0468eedfd5f4)), closes [#475](https://github.com/uuidjs/uuid/issues/475) [#478](https://github.com/uuidjs/uuid/issues/478) [#480](https://github.com/uuidjs/uuid/issues/480) [#481](https://github.com/uuidjs/uuid/issues/481) [#180](https://github.com/uuidjs/uuid/issues/180)\n\n## [8.2.0](https://github.com/uuidjs/uuid/compare/v8.1.0...v8.2.0) (2020-06-23)\n\n### Features\n\n- improve performance of v1 string representation ([#453](https://github.com/uuidjs/uuid/issues/453)) ([0ee0b67](https://github.com/uuidjs/uuid/commit/0ee0b67c37846529c66089880414d29f3ae132d5))\n- remove deprecated v4 string parameter ([#454](https://github.com/uuidjs/uuid/issues/454)) ([88ce3ca](https://github.com/uuidjs/uuid/commit/88ce3ca0ba046f60856de62c7ce03f7ba98ba46c)), closes [#437](https://github.com/uuidjs/uuid/issues/437)\n- support jspm ([#473](https://github.com/uuidjs/uuid/issues/473)) ([e9f2587](https://github.com/uuidjs/uuid/commit/e9f2587a92575cac31bc1d4ae944e17c09756659))\n\n### Bug Fixes\n\n- prepare package exports for webpack 5 ([#468](https://github.com/uuidjs/uuid/issues/468)) ([8d6e6a5](https://github.com/uuidjs/uuid/commit/8d6e6a5f8965ca9575eb4d92e99a43435f4a58a8))\n\n## [8.1.0](https://github.com/uuidjs/uuid/compare/v8.0.0...v8.1.0) (2020-05-20)\n\n### Features\n\n- improve v4 performance by reusing random number array ([#435](https://github.com/uuidjs/uuid/issues/435)) ([bf4af0d](https://github.com/uuidjs/uuid/commit/bf4af0d711b4d2ed03d1f74fd12ad0baa87dc79d))\n- optimize V8 performance of bytesToUuid ([#434](https://github.com/uuidjs/uuid/issues/434)) ([e156415](https://github.com/uuidjs/uuid/commit/e156415448ec1af2351fa0b6660cfb22581971f2))\n\n### Bug Fixes\n\n- export package.json required by react-native and bundlers ([#449](https://github.com/uuidjs/uuid/issues/449)) ([be1c8fe](https://github.com/uuidjs/uuid/commit/be1c8fe9a3206c358e0059b52fafd7213aa48a52)), closes [ai/nanoevents#44](https://github.com/ai/nanoevents/issues/44#issuecomment-602010343) [#444](https://github.com/uuidjs/uuid/issues/444)\n\n## [8.0.0](https://github.com/uuidjs/uuid/compare/v7.0.3...v8.0.0) (2020-04-29)\n\n### ⚠ BREAKING CHANGES\n\n- For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export.\n\n  ```diff\n  -import uuid from 'uuid';\n  -console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869'\n  +import { v4 as uuidv4 } from 'uuid';\n  +uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'\n  ```\n\n- Deep requiring specific algorithms of this library like `require('uuid/v4')`, which has been deprecated in `uuid@7`, is no longer supported.\n\n  Instead use the named exports that this module exports.\n\n  For ECMAScript Modules (ESM):\n\n  ```diff\n  -import uuidv4 from 'uuid/v4';\n  +import { v4 as uuidv4 } from 'uuid';\n  uuidv4();\n  ```\n\n  For CommonJS:\n\n  ```diff\n  -const uuidv4 = require('uuid/v4');\n  +const { v4: uuidv4 } = require('uuid');\n  uuidv4();\n  ```\n\n### Features\n\n- native Node.js ES Modules (wrapper approach) ([#423](https://github.com/uuidjs/uuid/issues/423)) ([2d9f590](https://github.com/uuidjs/uuid/commit/2d9f590ad9701d692625c07ed62f0a0f91227991)), closes [#245](https://github.com/uuidjs/uuid/issues/245) [#419](https://github.com/uuidjs/uuid/issues/419) [#342](https://github.com/uuidjs/uuid/issues/342)\n- remove deep requires ([#426](https://github.com/uuidjs/uuid/issues/426)) ([daf72b8](https://github.com/uuidjs/uuid/commit/daf72b84ceb20272a81bb5fbddb05dd95922cbba))\n\n### Bug Fixes\n\n- add CommonJS syntax example to README quickstart section ([#417](https://github.com/uuidjs/uuid/issues/417)) ([e0ec840](https://github.com/uuidjs/uuid/commit/e0ec8402c7ad44b7ef0453036c612f5db513fda0))\n\n### [7.0.3](https://github.com/uuidjs/uuid/compare/v7.0.2...v7.0.3) (2020-03-31)\n\n### Bug Fixes\n\n- make deep require deprecation warning work in browsers ([#409](https://github.com/uuidjs/uuid/issues/409)) ([4b71107](https://github.com/uuidjs/uuid/commit/4b71107d8c0d2ef56861ede6403fc9dc35a1e6bf)), closes [#408](https://github.com/uuidjs/uuid/issues/408)\n\n### [7.0.2](https://github.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04)\n\n### Bug Fixes\n\n- make access to msCrypto consistent ([#393](https://github.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://github.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c))\n- simplify link in deprecation warning ([#391](https://github.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://github.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7))\n- update links to match content in readme ([#386](https://github.com/uuidjs/uuid/issues/386)) ([44f2f86](https://github.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4))\n\n### [7.0.1](https://github.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25)\n\n### Bug Fixes\n\n- clean up esm builds for node and browser ([#383](https://github.com/uuidjs/uuid/issues/383)) ([59e6a49](https://github.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc))\n- provide browser versions independent from module system ([#380](https://github.com/uuidjs/uuid/issues/380)) ([4344a22](https://github.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#378](https://github.com/uuidjs/uuid/issues/378)\n\n## [7.0.0](https://github.com/uuidjs/uuid/compare/v3.4.0...v7.0.0) (2020-02-24)\n\n### ⚠ BREAKING CHANGES\n\n- The default export, which used to be the v4() method but which was already discouraged in v3.x of this library, has been removed.\n- Explicitly note that deep imports of the different uuid version functions are deprecated and no longer encouraged and that ECMAScript module named imports should be used instead. Emit a deprecation warning for people who deep-require the different algorithm variants.\n- Remove builtin support for insecure random number generators in the browser. Users who want that will have to supply their own random number generator function.\n- Remove support for generating v3 and v5 UUIDs in Node.js<4.x\n- Convert code base to ECMAScript Modules (ESM) and release CommonJS build for node and ESM build for browser bundlers.\n\n### Features\n\n- add UMD build to npm package ([#357](https://github.com/uuidjs/uuid/issues/357)) ([4e75adf](https://github.com/uuidjs/uuid/commit/4e75adf435196f28e3fbbe0185d654b5ded7ca2c)), closes [#345](https://github.com/uuidjs/uuid/issues/345)\n- add various es module and CommonJS examples ([b238510](https://github.com/uuidjs/uuid/commit/b238510bf352463521f74bab175a3af9b7a42555))\n- ensure that docs are up-to-date in CI ([ee5e77d](https://github.com/uuidjs/uuid/commit/ee5e77db547474f5a8f23d6c857a6d399209986b))\n- hybrid CommonJS & ECMAScript modules build ([a3f078f](https://github.com/uuidjs/uuid/commit/a3f078faa0baff69ab41aed08e041f8f9c8993d0))\n- remove insecure fallback random number generator ([3a5842b](https://github.com/uuidjs/uuid/commit/3a5842b141a6e5de0ae338f391661e6b84b167c9)), closes [#173](https://github.com/uuidjs/uuid/issues/173)\n- remove support for pre Node.js v4 Buffer API ([#356](https://github.com/uuidjs/uuid/issues/356)) ([b59b5c5](https://github.com/uuidjs/uuid/commit/b59b5c5ecad271c5453f1a156f011671f6d35627))\n- rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([c37a518](https://github.com/uuidjs/uuid/commit/c37a518e367ac4b6d0aa62dba1bc6ce9e85020f7)), closes [#338](https://github.com/uuidjs/uuid/issues/338)\n\n### Bug Fixes\n\n- add deep-require proxies for local testing and adjust tests ([#365](https://github.com/uuidjs/uuid/issues/365)) ([7fedc79](https://github.com/uuidjs/uuid/commit/7fedc79ac8fda4bfd1c566c7f05ef4ac13b2db48))\n- add note about removal of default export ([#372](https://github.com/uuidjs/uuid/issues/372)) ([12749b7](https://github.com/uuidjs/uuid/commit/12749b700eb49db8a9759fd306d8be05dbfbd58c)), closes [#370](https://github.com/uuidjs/uuid/issues/370)\n- deprecated deep requiring of the different algorithm versions ([#361](https://github.com/uuidjs/uuid/issues/361)) ([c0bdf15](https://github.com/uuidjs/uuid/commit/c0bdf15e417639b1aeb0b247b2fb11f7a0a26b23))\n\n## [3.4.0](https://github.com/uuidjs/uuid/compare/v3.3.3...v3.4.0) (2020-01-16)\n\n### Features\n\n- rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([e2d7314](https://github.com/uuidjs/uuid/commit/e2d7314)), closes [#338](https://github.com/uuidjs/uuid/issues/338)\n\n## [3.3.3](https://github.com/uuidjs/uuid/compare/v3.3.2...v3.3.3) (2019-08-19)\n\n### Bug Fixes\n\n- no longer run ci tests on node v4\n- upgrade dependencies\n\n## [3.3.2](https://github.com/uuidjs/uuid/compare/v3.3.1...v3.3.2) (2018-06-28)\n\n### Bug Fixes\n\n- typo ([305d877](https://github.com/uuidjs/uuid/commit/305d877))\n\n## [3.3.1](https://github.com/uuidjs/uuid/compare/v3.3.0...v3.3.1) (2018-06-28)\n\n### Bug Fixes\n\n- fix [#284](https://github.com/uuidjs/uuid/issues/284) by setting function name in try-catch ([f2a60f2](https://github.com/uuidjs/uuid/commit/f2a60f2))\n\n# [3.3.0](https://github.com/uuidjs/uuid/compare/v3.2.1...v3.3.0) (2018-06-22)\n\n### Bug Fixes\n\n- assignment to readonly property to allow running in strict mode ([#270](https://github.com/uuidjs/uuid/issues/270)) ([d062fdc](https://github.com/uuidjs/uuid/commit/d062fdc))\n- fix [#229](https://github.com/uuidjs/uuid/issues/229) ([c9684d4](https://github.com/uuidjs/uuid/commit/c9684d4))\n- Get correct version of IE11 crypto ([#274](https://github.com/uuidjs/uuid/issues/274)) ([153d331](https://github.com/uuidjs/uuid/commit/153d331))\n- mem issue when generating uuid ([#267](https://github.com/uuidjs/uuid/issues/267)) ([c47702c](https://github.com/uuidjs/uuid/commit/c47702c))\n\n### Features\n\n- enforce Conventional Commit style commit messages ([#282](https://github.com/uuidjs/uuid/issues/282)) ([cc9a182](https://github.com/uuidjs/uuid/commit/cc9a182))\n\n## [3.2.1](https://github.com/uuidjs/uuid/compare/v3.2.0...v3.2.1) (2018-01-16)\n\n### Bug Fixes\n\n- use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b))\n\n# [3.2.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.2.0) (2018-01-16)\n\n### Bug Fixes\n\n- remove mistakenly added typescript dependency, rollback version (standard-version will auto-increment) ([09fa824](https://github.com/uuidjs/uuid/commit/09fa824))\n- use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b))\n\n### Features\n\n- Add v3 Support ([#217](https://github.com/uuidjs/uuid/issues/217)) ([d94f726](https://github.com/uuidjs/uuid/commit/d94f726))\n\n# [3.1.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.0.1) (2017-06-17)\n\n### Bug Fixes\n\n- (fix) Add .npmignore file to exclude test/ and other non-essential files from packing. (#183)\n- Fix typo (#178)\n- Simple typo fix (#165)\n\n### Features\n\n- v5 support in CLI (#197)\n- V5 support (#188)\n\n# 3.0.1 (2016-11-28)\n\n- split uuid versions into separate files\n\n# 3.0.0 (2016-11-17)\n\n- remove .parse and .unparse\n\n# 2.0.0\n\n- Removed uuid.BufferClass\n\n# 1.4.0\n\n- Improved module context detection\n- Removed public RNG functions\n\n# 1.3.2\n\n- Improve tests and handling of v1() options (Issue #24)\n- Expose RNG option to allow for perf testing with different generators\n\n# 1.3.0\n\n- Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!\n- Support for node.js crypto API\n- De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\n## Development\n\n1. Clone this repo\n2. `npm install` to install dev dependencies\n3. VSCode is the recommended dev environment\n\n- Includes \"Build Watcher\" and \"Test Watcher\" tasks (Terminal pane)\n- (optional) Install the recommended extensions (Extensions sidebar)\n\n4. Before submitting your PR, make sure tests pass:\n\n- `npm test && npm run test:node`\n\n## README updates\n\n**Do not edit README.md manually**. To make changes to the README:\n\n1. Edit README_js.md\n2. Run `npm run docs` to regenerate README.md\n3. If using VSCode, it's\n\n## Testing\n\n```shell\nnpm test\n```\n"
  },
  {
    "path": "LICENSE.md",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2010-2020 Robert Kieffer and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "<!--\n  -- This file is auto-generated from README_js.md. Changes should be made there.\n  -->\n\n# uuid [![CI](https://github.com/uuidjs/uuid/workflows/CI/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [![Browser](https://github.com/uuidjs/uuid/workflows/Browser/badge.svg)](https://github.com/uuidjs/uuid/actions/workflows/browser.yml)\n\nFor the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formerly [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs\n\n- **Complete** - Support for all RFC9562 UUID versions\n- **Cross-platform** - Support for...\n  - [Typescript](#support)\n  - [Chrome, Safari, Firefox, and Edge](#support)\n  - [NodeJS](#support)\n  - [React Native / Expo](#react-native--expo)\n- **Secure** - Uses modern `crypto` API for random values\n- **Compact** - Zero-dependency, [tree-shakable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking)\n- **CLI** - [`uuid` command line](#command-line) utility\n\n<!-- prettier-ignore -->\n> [!NOTE]\n>\n> Starting with `uuid@12` CommonJS is no longer supported.  See [implications](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) and [motivation](https://github.com/uuidjs/uuid/issues/881) for details.\n\n## Quickstart\n\n**1. Install**\n\n```shell\nnpm install uuid\n```\n\n**2. Create a UUID**\n\n```javascript\nimport { v4 as uuidv4 } from 'uuid';\n\nuuidv4(); // ⇨ '23c37ede-1c09-422a-8da8-42ad65cc33f9'\n```\n\nFor timestamp UUIDs, namespace UUIDs, and other options read on ...\n\n## API Summary\n\n|  |  |  |\n| --- | --- | --- |\n| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` |\n| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) | New in `uuid@9.1` |\n| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` |\n| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` |\n| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID |  |\n| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` |\n| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID |  |\n| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID |  |\n| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID |  |\n| [`uuid.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` |\n| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` |\n| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` |\n| ~~[`uuid.v8()`](#uuidv8)~~ | \"Intentionally left blank\" |  |\n| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `uuid@8.3` |\n| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `uuid@8.3` |\n\n## API\n\n### uuid.NIL\n\nThe nil UUID string (all zeros).\n\nExample:\n\n```javascript\nimport { NIL as NIL_UUID } from 'uuid';\n\nNIL_UUID; // ⇨ '00000000-0000-0000-0000-000000000000'\n```\n\n### uuid.MAX\n\nThe max UUID string (all ones).\n\nExample:\n\n```javascript\nimport { MAX as MAX_UUID } from 'uuid';\n\nMAX_UUID; // ⇨ 'ffffffff-ffff-ffff-ffff-ffffffffffff'\n```\n\n### uuid.parse(str)\n\nConvert UUID string to array of bytes\n\n|           |                                          |\n| --------- | ---------------------------------------- |\n| `str`     | A valid UUID `String`                    |\n| _returns_ | `Uint8Array[16]`                         |\n| _throws_  | `TypeError` if `str` is not a valid UUID |\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left &Rarr; right order of hex-pairs in UUID strings. As shown in the example below.\n\nExample:\n\n```javascript\nimport { parse as uuidParse } from 'uuid';\n\n// Parse a UUID\nuuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨\n// Uint8Array(16) [\n//   110, 192, 189, 127,  17,\n//   192,  67, 218, 151,  94,\n//    42, 138, 217, 235, 174,\n//    11\n// ]\n```\n\n### uuid.stringify(arr[, offset])\n\nConvert array of bytes to UUID string\n\n|                |                                                                              |\n| -------------- | ---------------------------------------------------------------------------- |\n| `arr`          | `Array`-like collection of 16 values (starting from `offset`) between 0-255. |\n| [`offset` = 0] | `Number` Starting index in the Array                                         |\n| _returns_      | `String`                                                                     |\n| _throws_       | `TypeError` if a valid UUID string cannot be generated                       |\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left &Rarr; right order of hex-pairs in UUID strings. As shown in the example below.\n\nExample:\n\n```javascript\nimport { stringify as uuidStringify } from 'uuid';\n\nconst uuidBytes = Uint8Array.of(\n  0x6e,\n  0xc0,\n  0xbd,\n  0x7f,\n  0x11,\n  0xc0,\n  0x43,\n  0xda,\n  0x97,\n  0x5e,\n  0x2a,\n  0x8a,\n  0xd9,\n  0xeb,\n  0xae,\n  0x0b\n);\n\nuuidStringify(uuidBytes); // ⇨ '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'\n```\n\n### uuid.v1([options[, buffer[, offset]]])\n\nCreate an RFC version 1 (timestamp) UUID\n\n|  |  |\n| --- | --- |\n| [`options`] | `Object` with one or more of the following properties: |\n| [`options.node = (random)` ] | RFC \"node\" field as an `Array[6]` of byte values (per 4.1.6) |\n| [`options.clockseq = (random)`] | RFC \"clock sequence\" as a `Number` between 0 - 0x3fff |\n| [`options.msecs = (current time)`] | RFC \"timestamp\" field (`Number` of milliseconds, unix epoch) |\n| [`options.nsecs = 0`] | RFC \"timestamp\" field (`Number` of nanoseconds to add to `msecs`, should be 0-10,000) |\n| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |\n| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |\n| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |\n| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |\n| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |\n| _throws_ | `Error` if more than 10M UUIDs/sec are requested |\n\nExample:\n\n```javascript\nimport { v1 as uuidv1 } from 'uuid';\n\nuuidv1(); // ⇨ 'a2bfad10-b358-11f0-8d45-6389dd784317'\n```\n\nExample using `options`:\n\n```javascript\nimport { v1 as uuidv1 } from 'uuid';\n\nconst options = {\n  node: Uint8Array.of(0x01, 0x23, 0x45, 0x67, 0x89, 0xab),\n  clockseq: 0x1234,\n  msecs: new Date('2011-11-01').getTime(),\n  nsecs: 5678,\n};\nuuidv1(options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'\n```\n\n### uuid.v1ToV6(uuid)\n\nConvert a UUID from version 1 to version 6\n\n```javascript\nimport { v1ToV6 } from 'uuid';\n\nv1ToV6('92f62d9e-22c4-11ef-97e9-325096b39f47'); // ⇨ '1ef22c49-2f62-6d9e-97e9-325096b39f47'\n```\n\n### uuid.v3(name, namespace[, buffer[, offset]])\n\nCreate an RFC version 3 (namespace w/ MD5) UUID\n\nAPI is identical to `v5()`, but uses \"v3\" instead.\n\n<!-- prettier-ignore -->\n> [!IMPORTANT]\n> Per the RFC, \"_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_.\"\n\n### uuid.v4([options[, buffer[, offset]]])\n\nCreate an RFC version 4 (random) UUID\n\n|  |  |\n| --- | --- |\n| [`options`] | `Object` with one or more of the following properties: |\n| [`options.random`] | `Array` of 16 random bytes (0-255) |\n| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |\n| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |\n| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |\n| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |\n\nExample:\n\n```javascript\nimport { v4 as uuidv4 } from 'uuid';\n\nuuidv4(); // ⇨ '177fac08-7fee-4a08-abda-72eb3ce87fba'\n```\n\nExample using predefined `random` values:\n\n```javascript\nimport { v4 as uuidv4 } from 'uuid';\n\nconst v4options = {\n  random: Uint8Array.of(\n    0x10,\n    0x91,\n    0x56,\n    0xbe,\n    0xc4,\n    0xfb,\n    0xc1,\n    0xea,\n    0x71,\n    0xb4,\n    0xef,\n    0xe1,\n    0x67,\n    0x1c,\n    0x58,\n    0x36\n  ),\n};\nuuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'\n```\n\n### uuid.v5(name, namespace[, buffer[, offset]])\n\nCreate an RFC version 5 (namespace w/ SHA-1) UUID\n\n|  |  |\n| --- | --- |\n| `name` | `String \\| Array` |\n| `namespace` | `String \\| Array[16]` Namespace UUID |\n| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |\n| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |\n| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> The RFC `DNS` and `URL` namespaces are available as `v5.DNS` and `v5.URL`.\n\nExample with custom namespace:\n\n```javascript\nimport { v5 as uuidv5 } from 'uuid';\n\n// Define a custom namespace.  Readers, create your own using something like\n// https://www.uuidgenerator.net/\nconst MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';\n\nuuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'\n```\n\nExample with RFC `URL` namespace:\n\n```javascript\nimport { v5 as uuidv5 } from 'uuid';\n\nuuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1'\n```\n\n### uuid.v6([options[, buffer[, offset]]])\n\nCreate an RFC version 6 (timestamp, reordered) UUID\n\nThis method takes the same arguments as uuid.v1().\n\n```javascript\nimport { v6 as uuidv6 } from 'uuid';\n\nuuidv6(); // ⇨ '1f0b358a-2c04-6950-8ac9-a8f01d2998d6'\n```\n\nExample using `options`:\n\n```javascript\nimport { v6 as uuidv6 } from 'uuid';\n\nconst options = {\n  node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],\n  clockseq: 0x1234,\n  msecs: new Date('2011-11-01').getTime(),\n  nsecs: 5678,\n};\nuuidv6(options); // ⇨ '1e1041c7-10b9-662e-9234-0123456789ab'\n```\n\n### uuid.v6ToV1(uuid)\n\nConvert a UUID from version 6 to version 1\n\n```javascript\nimport { v6ToV1 } from 'uuid';\n\nv6ToV1('1ef22c49-2f62-6d9e-97e9-325096b39f47'); // ⇨ '92f62d9e-22c4-11ef-97e9-325096b39f47'\n```\n\n### uuid.v7([options[, buffer[, offset]]])\n\nCreate an RFC version 7 (random) UUID\n\n|  |  |\n| --- | --- |\n| [`options`] | `Object` with one or more of the following properties: |\n| [`options.msecs = (current time)`] | RFC \"timestamp\" field (`Number` of milliseconds, unix epoch) |\n| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |\n| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |\n| [`options.seq = (random)`] | 32-bit sequence `Number` between 0 - 0xffffffff. This may be provided to help ensure uniqueness for UUIDs generated within the same millisecond time interval. Default = random value. |\n| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |\n| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |\n| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |\n\nExample:\n\n```javascript\nimport { v7 as uuidv7 } from 'uuid';\n\nuuidv7(); // ⇨ '019a26ab-9a66-71a9-a89e-63c35fce4a5a'\n```\n\n### ~~uuid.v8()~~\n\n**_\"Intentionally left blank\"_**\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> Version 8 (experimental) UUIDs are \"[for experimental or vendor-specific use cases](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-8)\".  The RFC does not define a creation algorithm for them, which is why this package does not offer a `v8()` method.  The `validate()` and `version()` methods do work with such UUIDs, however.\n\n### uuid.validate(str)\n\nTest a string to see if it is a valid UUID\n\n|           |                                                     |\n| --------- | --------------------------------------------------- |\n| `str`     | `String` to validate                                |\n| _returns_ | `true` if string is a valid UUID, `false` otherwise |\n\nExample:\n\n```javascript\nimport { validate as uuidValidate } from 'uuid';\n\nuuidValidate('not a UUID'); // ⇨ false\nuuidValidate('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ true\n```\n\nUsing `validate` and `version` together it is possible to do per-version validation, e.g. validate for only v4 UUIds.\n\n```javascript\nimport { version as uuidVersion } from 'uuid';\nimport { validate as uuidValidate } from 'uuid';\n\nfunction uuidValidateV4(uuid) {\n  return uuidValidate(uuid) && uuidVersion(uuid) === 4;\n}\n\nconst v1Uuid = 'd9428888-122b-11e1-b85c-61cd3cbb3210';\nconst v4Uuid = '109156be-c4fb-41ea-b1b4-efe1671c5836';\n\nuuidValidateV4(v4Uuid); // ⇨ true\nuuidValidateV4(v1Uuid); // ⇨ false\n```\n\n### uuid.version(str)\n\nDetect RFC version of a UUID\n\n|           |                                          |\n| --------- | ---------------------------------------- |\n| `str`     | A valid UUID `String`                    |\n| _returns_ | `Number` The RFC version of the UUID     |\n| _throws_  | `TypeError` if `str` is not a valid UUID |\n\nExample:\n\n```javascript\nimport { version as uuidVersion } from 'uuid';\n\nuuidVersion('45637ec4-c85f-11ea-87d0-0242ac130003'); // ⇨ 1\nuuidVersion('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ 4\n```\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> This method returns `0` for the `NIL` UUID, and `15` for the `MAX` UUID.\n\n## Command Line\n\nUUIDs can be generated from the command line using `uuid`.\n\n```shell\n$ npx uuid\nddeb27fb-d9a0-4624-be4d-4615062daed4\n```\n\nThe default is to generate version 4 UUIDS, however the other versions are supported. Type `uuid --help` for details:\n\n```shell\n$ npx uuid --help\n\nUsage:\n  uuid\n  uuid v1\n  uuid v3 <name> <namespace uuid>\n  uuid v4\n  uuid v5 <name> <namespace uuid>\n  uuid v7\n  uuid --help\n\nNote: <namespace uuid> may be \"URL\" or \"DNS\" to use the corresponding UUIDs\ndefined by RFC9562\n```\n\n## `options` Handling for Timestamp UUIDs\n\nPrior to `uuid@11`, it was possible for `options` state to interfere with the internal state used to ensure uniqueness of timestamp-based UUIDs (the `v1()`, `v6()`, and `v7()` methods). Starting with `uuid@11`, this issue has been addressed by using the presence of the `options` argument as a flag to select between two possible behaviors:\n\n- Without `options`: Internal state is utilized to improve UUID uniqueness.\n- With `options`: Internal state is **NOT** used and, instead, appropriate defaults are applied as needed.\n\n## Support\n\n**Browsers**: `uuid` [builds are tested](/uuidjs/uuid/blob/main/wdio.conf.js) against the latest version of desktop Chrome, Safari, Firefox, and Edge. Mobile versions of these same browsers are expected to work but aren't currently tested.\n\n**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. At the time of this writing `node@20` is the \"maintenance\" release and `node@24` is the \"current\" release, so `uuid` supports `node@18`-`node@24`.\n\n**Typescript**: TS versions released within the past two years are supported. [source](https://github.com/microsoft/TypeScript/issues/49088#issuecomment-2468723715)\n\n## Known issues\n\n<!-- This header is referenced as an anchor in src/rng-browser.ts -->\n\n### \"getRandomValues() not supported\"\n\nThis error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill:\n\n#### React Native / Expo\n\n1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme)\n1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point:\n\n```javascript\nimport 'react-native-get-random-values';\nimport { v4 as uuidv4 } from 'uuid';\n```\n\n---\n\nMarkdown generated from [README_js.md](README_js.md) by <a href=\"https://github.com/broofa/runmd\"><image height=\"13\" src=\"https://camo.githubusercontent.com/5c7c603cd1e6a43370b0a5063d457e0dabb74cf317adc7baba183acb686ee8d0/687474703a2f2f692e696d6775722e636f6d2f634a4b6f3662552e706e67\" /></a>\n"
  },
  {
    "path": "README_js.md",
    "content": "```javascript --hide\nrunmd.onRequire = (path) => {\n  if (path == 'rng') return fun;\n  return path.replace(/^uuid/, './dist/');\n};\n```\n\n# uuid [![CI](https://github.com/uuidjs/uuid/workflows/CI/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [![Browser](https://github.com/uuidjs/uuid/workflows/Browser/badge.svg)](https://github.com/uuidjs/uuid/actions/workflows/browser.yml)\n\nFor the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formerly [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs\n\n- **Complete** - Support for all RFC9562 UUID versions\n- **Cross-platform** - Support for...\n  - [Typescript](#support)\n  - [Chrome, Safari, Firefox, and Edge](#support)\n  - [NodeJS](#support)\n  - [React Native / Expo](#react-native--expo)\n- **Secure** - Uses modern `crypto` API for random values\n- **Compact** - Zero-dependency, [tree-shakable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking)\n- **CLI** - [`uuid` command line](#command-line) utility\n\n<!-- prettier-ignore -->\n> [!NOTE]\n>\n> Starting with `uuid@12` CommonJS is no longer supported.  See [implications](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) and [motivation](https://github.com/uuidjs/uuid/issues/881) for details.\n\n## Quickstart\n\n**1. Install**\n\n```shell\nnpm install uuid\n```\n\n**2. Create a UUID**\n\n```javascript --run\nimport { v4 as uuidv4 } from 'uuid';\n\nuuidv4(); // RESULT\n```\n\nFor timestamp UUIDs, namespace UUIDs, and other options read on ...\n\n## API Summary\n\n|  |  |  |\n| --- | --- | --- |\n| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` |\n| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) | New in `uuid@9.1` |\n| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` |\n| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` |\n| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID |  |\n| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` |\n| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID |  |\n| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID |  |\n| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID |  |\n| [`uuid.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` |\n| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` |\n| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` |\n| ~~[`uuid.v8()`](#uuidv8)~~ | \"Intentionally left blank\" |  |\n| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `uuid@8.3` |\n| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `uuid@8.3` |\n\n## API\n\n### uuid.NIL\n\nThe nil UUID string (all zeros).\n\nExample:\n\n```javascript --run\nimport { NIL as NIL_UUID } from 'uuid';\n\nNIL_UUID; // RESULT\n```\n\n### uuid.MAX\n\nThe max UUID string (all ones).\n\nExample:\n\n```javascript --run\nimport { MAX as MAX_UUID } from 'uuid';\n\nMAX_UUID; // RESULT\n```\n\n### uuid.parse(str)\n\nConvert UUID string to array of bytes\n\n|           |                                          |\n| --------- | ---------------------------------------- |\n| `str`     | A valid UUID `String`                    |\n| _returns_ | `Uint8Array[16]`                         |\n| _throws_  | `TypeError` if `str` is not a valid UUID |\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left &Rarr; right order of hex-pairs in UUID strings. As shown in the example below.\n\nExample:\n\n```javascript --run\nimport { parse as uuidParse } from 'uuid';\n\n// Parse a UUID\nuuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // RESULT\n```\n\n### uuid.stringify(arr[, offset])\n\nConvert array of bytes to UUID string\n\n|                |                                                                              |\n| -------------- | ---------------------------------------------------------------------------- |\n| `arr`          | `Array`-like collection of 16 values (starting from `offset`) between 0-255. |\n| [`offset` = 0] | `Number` Starting index in the Array                                         |\n| _returns_      | `String`                                                                     |\n| _throws_       | `TypeError` if a valid UUID string cannot be generated                       |\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left &Rarr; right order of hex-pairs in UUID strings. As shown in the example below.\n\nExample:\n\n```javascript --run\nimport { stringify as uuidStringify } from 'uuid';\n\nconst uuidBytes = Uint8Array.of(\n  0x6e,\n  0xc0,\n  0xbd,\n  0x7f,\n  0x11,\n  0xc0,\n  0x43,\n  0xda,\n  0x97,\n  0x5e,\n  0x2a,\n  0x8a,\n  0xd9,\n  0xeb,\n  0xae,\n  0x0b\n);\n\nuuidStringify(uuidBytes); // RESULT\n```\n\n### uuid.v1([options[, buffer[, offset]]])\n\nCreate an RFC version 1 (timestamp) UUID\n\n|  |  |\n| --- | --- |\n| [`options`] | `Object` with one or more of the following properties: |\n| [`options.node = (random)` ] | RFC \"node\" field as an `Array[6]` of byte values (per 4.1.6) |\n| [`options.clockseq = (random)`] | RFC \"clock sequence\" as a `Number` between 0 - 0x3fff |\n| [`options.msecs = (current time)`] | RFC \"timestamp\" field (`Number` of milliseconds, unix epoch) |\n| [`options.nsecs = 0`] | RFC \"timestamp\" field (`Number` of nanoseconds to add to `msecs`, should be 0-10,000) |\n| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |\n| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |\n| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |\n| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |\n| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |\n| _throws_ | `Error` if more than 10M UUIDs/sec are requested |\n\nExample:\n\n```javascript --run\nimport { v1 as uuidv1 } from 'uuid';\n\nuuidv1(); // RESULT\n```\n\nExample using `options`:\n\n```javascript --run\nimport { v1 as uuidv1 } from 'uuid';\n\nconst options = {\n  node: Uint8Array.of(0x01, 0x23, 0x45, 0x67, 0x89, 0xab),\n  clockseq: 0x1234,\n  msecs: new Date('2011-11-01').getTime(),\n  nsecs: 5678,\n};\nuuidv1(options); // RESULT\n```\n\n### uuid.v1ToV6(uuid)\n\nConvert a UUID from version 1 to version 6\n\n```javascript --run\nimport { v1ToV6 } from 'uuid';\n\nv1ToV6('92f62d9e-22c4-11ef-97e9-325096b39f47'); // RESULT\n```\n\n### uuid.v3(name, namespace[, buffer[, offset]])\n\nCreate an RFC version 3 (namespace w/ MD5) UUID\n\nAPI is identical to `v5()`, but uses \"v3\" instead.\n\n<!-- prettier-ignore -->\n> [!IMPORTANT]\n> Per the RFC, \"_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_.\"\n\n### uuid.v4([options[, buffer[, offset]]])\n\nCreate an RFC version 4 (random) UUID\n\n|  |  |\n| --- | --- |\n| [`options`] | `Object` with one or more of the following properties: |\n| [`options.random`] | `Array` of 16 random bytes (0-255) |\n| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |\n| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |\n| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |\n| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |\n\nExample:\n\n```javascript --run\nimport { v4 as uuidv4 } from 'uuid';\n\nuuidv4(); // RESULT\n```\n\nExample using predefined `random` values:\n\n```javascript --run\nimport { v4 as uuidv4 } from 'uuid';\n\nconst v4options = {\n  random: Uint8Array.of(\n    0x10,\n    0x91,\n    0x56,\n    0xbe,\n    0xc4,\n    0xfb,\n    0xc1,\n    0xea,\n    0x71,\n    0xb4,\n    0xef,\n    0xe1,\n    0x67,\n    0x1c,\n    0x58,\n    0x36\n  ),\n};\nuuidv4(v4options); // RESULT\n```\n\n### uuid.v5(name, namespace[, buffer[, offset]])\n\nCreate an RFC version 5 (namespace w/ SHA-1) UUID\n\n|  |  |\n| --- | --- |\n| `name` | `String \\| Array` |\n| `namespace` | `String \\| Array[16]` Namespace UUID |\n| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |\n| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |\n| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> The RFC `DNS` and `URL` namespaces are available as `v5.DNS` and `v5.URL`.\n\nExample with custom namespace:\n\n```javascript --run\nimport { v5 as uuidv5 } from 'uuid';\n\n// Define a custom namespace.  Readers, create your own using something like\n// https://www.uuidgenerator.net/\nconst MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';\n\nuuidv5('Hello, World!', MY_NAMESPACE); // RESULT\n```\n\nExample with RFC `URL` namespace:\n\n```javascript --run\nimport { v5 as uuidv5 } from 'uuid';\n\nuuidv5('https://www.w3.org/', uuidv5.URL); // RESULT\n```\n\n### uuid.v6([options[, buffer[, offset]]])\n\nCreate an RFC version 6 (timestamp, reordered) UUID\n\nThis method takes the same arguments as uuid.v1().\n\n```javascript --run\nimport { v6 as uuidv6 } from 'uuid';\n\nuuidv6(); // RESULT\n```\n\nExample using `options`:\n\n```javascript --run\nimport { v6 as uuidv6 } from 'uuid';\n\nconst options = {\n  node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],\n  clockseq: 0x1234,\n  msecs: new Date('2011-11-01').getTime(),\n  nsecs: 5678,\n};\nuuidv6(options); // RESULT\n```\n\n### uuid.v6ToV1(uuid)\n\nConvert a UUID from version 6 to version 1\n\n```javascript --run\nimport { v6ToV1 } from 'uuid';\n\nv6ToV1('1ef22c49-2f62-6d9e-97e9-325096b39f47'); // RESULT\n```\n\n### uuid.v7([options[, buffer[, offset]]])\n\nCreate an RFC version 7 (random) UUID\n\n|  |  |\n| --- | --- |\n| [`options`] | `Object` with one or more of the following properties: |\n| [`options.msecs = (current time)`] | RFC \"timestamp\" field (`Number` of milliseconds, unix epoch) |\n| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |\n| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |\n| [`options.seq = (random)`] | 32-bit sequence `Number` between 0 - 0xffffffff. This may be provided to help ensure uniqueness for UUIDs generated within the same millisecond time interval. Default = random value. |\n| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |\n| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |\n| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |\n\nExample:\n\n```javascript --run\nimport { v7 as uuidv7 } from 'uuid';\n\nuuidv7(); // RESULT\n```\n\n### ~~uuid.v8()~~\n\n**_\"Intentionally left blank\"_**\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> Version 8 (experimental) UUIDs are \"[for experimental or vendor-specific use cases](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-8)\".  The RFC does not define a creation algorithm for them, which is why this package does not offer a `v8()` method.  The `validate()` and `version()` methods do work with such UUIDs, however.\n\n### uuid.validate(str)\n\nTest a string to see if it is a valid UUID\n\n|           |                                                     |\n| --------- | --------------------------------------------------- |\n| `str`     | `String` to validate                                |\n| _returns_ | `true` if string is a valid UUID, `false` otherwise |\n\nExample:\n\n```javascript --run\nimport { validate as uuidValidate } from 'uuid';\n\nuuidValidate('not a UUID'); // RESULT\nuuidValidate('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // RESULT\n```\n\nUsing `validate` and `version` together it is possible to do per-version validation, e.g. validate for only v4 UUIds.\n\n```javascript --run\nimport { version as uuidVersion } from 'uuid';\nimport { validate as uuidValidate } from 'uuid';\n\nfunction uuidValidateV4(uuid) {\n  return uuidValidate(uuid) && uuidVersion(uuid) === 4;\n}\n\nconst v1Uuid = 'd9428888-122b-11e1-b85c-61cd3cbb3210';\nconst v4Uuid = '109156be-c4fb-41ea-b1b4-efe1671c5836';\n\nuuidValidateV4(v4Uuid); // RESULT\nuuidValidateV4(v1Uuid); // RESULT\n```\n\n### uuid.version(str)\n\nDetect RFC version of a UUID\n\n|           |                                          |\n| --------- | ---------------------------------------- |\n| `str`     | A valid UUID `String`                    |\n| _returns_ | `Number` The RFC version of the UUID     |\n| _throws_  | `TypeError` if `str` is not a valid UUID |\n\nExample:\n\n```javascript --run\nimport { version as uuidVersion } from 'uuid';\n\nuuidVersion('45637ec4-c85f-11ea-87d0-0242ac130003'); // RESULT\nuuidVersion('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // RESULT\n```\n\n<!-- prettier-ignore -->\n> [!NOTE]\n> This method returns `0` for the `NIL` UUID, and `15` for the `MAX` UUID.\n\n## Command Line\n\nUUIDs can be generated from the command line using `uuid`.\n\n```shell\n$ npx uuid\nddeb27fb-d9a0-4624-be4d-4615062daed4\n```\n\nThe default is to generate version 4 UUIDS, however the other versions are supported. Type `uuid --help` for details:\n\n```shell\n$ npx uuid --help\n\nUsage:\n  uuid\n  uuid v1\n  uuid v3 <name> <namespace uuid>\n  uuid v4\n  uuid v5 <name> <namespace uuid>\n  uuid v7\n  uuid --help\n\nNote: <namespace uuid> may be \"URL\" or \"DNS\" to use the corresponding UUIDs\ndefined by RFC9562\n```\n\n## `options` Handling for Timestamp UUIDs\n\nPrior to `uuid@11`, it was possible for `options` state to interfere with the internal state used to ensure uniqueness of timestamp-based UUIDs (the `v1()`, `v6()`, and `v7()` methods). Starting with `uuid@11`, this issue has been addressed by using the presence of the `options` argument as a flag to select between two possible behaviors:\n\n- Without `options`: Internal state is utilized to improve UUID uniqueness.\n- With `options`: Internal state is **NOT** used and, instead, appropriate defaults are applied as needed.\n\n## Support\n\n**Browsers**: `uuid` [builds are tested](/uuidjs/uuid/blob/main/wdio.conf.js) against the latest version of desktop Chrome, Safari, Firefox, and Edge. Mobile versions of these same browsers are expected to work but aren't currently tested.\n\n**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. At the time of this writing `node@20` is the \"maintenance\" release and `node@24` is the \"current\" release, so `uuid` supports `node@18`-`node@24`.\n\n**Typescript**: TS versions released within the past two years are supported. [source](https://github.com/microsoft/TypeScript/issues/49088#issuecomment-2468723715)\n\n## Known issues\n\n<!-- This header is referenced as an anchor in src/rng-browser.ts -->\n\n### \"getRandomValues() not supported\"\n\nThis error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill:\n\n#### React Native / Expo\n\n1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme)\n1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point:\n\n```javascript\nimport 'react-native-get-random-values';\nimport { v4 as uuidv4 } from 'uuid';\n```\n"
  },
  {
    "path": "bundlewatch.config.json",
    "content": "{\n  \"ci\": {\n    \"repoBranchBase\": \"main\",\n    \"trackBranches\": [\"main\"]\n  },\n  \"files\": [\n    { \"path\": \"./examples/browser-rollup/dist/v1-size.js\", \"maxSize\": \"1.0 kB\" },\n    { \"path\": \"./examples/browser-rollup/dist/v3-size.js\", \"maxSize\": \"2.1 kB\" },\n    { \"path\": \"./examples/browser-rollup/dist/v4-size.js\", \"maxSize\": \"0.7 kB\" },\n    { \"path\": \"./examples/browser-rollup/dist/v5-size.js\", \"maxSize\": \"1.5 kB\" },\n    { \"path\": \"./examples/browser-rollup/dist/v6-size.js\", \"maxSize\": \"1.6 kB\" },\n    { \"path\": \"./examples/browser-rollup/dist/v7-size.js\", \"maxSize\": \"0.8 kB\" },\n    { \"path\": \"./examples/browser-webpack/dist/v1-size.js\", \"maxSize\": \"1.0 kB\" },\n    { \"path\": \"./examples/browser-webpack/dist/v3-size.js\", \"maxSize\": \"2.1 kB\" },\n    { \"path\": \"./examples/browser-webpack/dist/v4-size.js\", \"maxSize\": \"0.7 kB\" },\n    { \"path\": \"./examples/browser-webpack/dist/v5-size.js\", \"maxSize\": \"1.5 kB\" },\n    { \"path\": \"./examples/browser-webpack/dist/v6-size.js\", \"maxSize\": \"1.6 kB\" },\n    { \"path\": \"./examples/browser-webpack/dist/v7-size.js\", \"maxSize\": \"0.8 kB\" }\n  ]\n}\n"
  },
  {
    "path": "eslint.config.mjs",
    "content": "import js from '@eslint/js';\nimport eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';\nimport globals from 'globals';\nimport neostandard from 'neostandard';\nimport tseslint from 'typescript-eslint';\n\nconst neostandardConfig = neostandard({ semi: true, noStyle: true });\n\nexport default [\n  js.configs.recommended,\n  ...tseslint.configs.recommended,\n  ...neostandardConfig,\n  eslintPluginPrettierRecommended,\n  {\n    languageOptions: {\n      ecmaVersion: 'latest',\n      sourceType: 'module',\n      globals: {\n        ...globals.browser,\n        ...globals.commonjs,\n        ...globals.jest,\n        ...globals.node,\n      },\n    },\n  },\n  {\n    rules: {\n      '@typescript-eslint/no-redeclare': 'error',\n      '@typescript-eslint/no-require-imports': 'off',\n      'no-redeclare': 'off',\n      'no-var': ['error'],\n      curly: ['error', 'all'],\n    },\n  },\n  {\n    ignores: ['eslint.config.cjs', '**/dist/', 'node_modules/'],\n  },\n];\n"
  },
  {
    "path": "examples/benchmark/README.md",
    "content": "# uuid Benchmark\n\n```\nnpm install\n```\n\n## Node.js\n\nTo run the benchmark in Node.js, run `npm test`.\n\n## Browser\n\nTo run the benchmark in the browser run `npm run start`, open `benchmark.html`, and check the console.\n\nExample output (`uuid@8.0.0`, MacBook Pro (Retina, 13-inch, Early 2015), 3.1 GHz Dual-Core Intel Core i7):\n\n```\nStarting. Tests take ~1 minute to run ...\nuuidv1() x 1,306,861 ops/sec ±2.62% (85 runs sampled)\nuuidv1() fill existing array x 4,750,515 ops/sec ±2.76% (88 runs sampled)\nuuidv4() x 302,174 ops/sec ±3.06% (81 runs sampled)\nuuidv4() fill existing array x 359,703 ops/sec ±3.67% (82 runs sampled)\nuuidv3() x 105,667 ops/sec ±3.84% (79 runs sampled)\nuuidv5() x 110,886 ops/sec ±2.55% (81 runs sampled)\nFastest is uuidv1() fill existing array\n```\n"
  },
  {
    "path": "examples/benchmark/benchmark.html",
    "content": "<!doctype html>\n<title>UUID Benchmark</title>\n<p>Please open the Developer Console to view output</p>\n<script type=\"module\" src=\"./browser.js\"></script>\n"
  },
  {
    "path": "examples/benchmark/benchmark.js",
    "content": "export default function benchmark(uuid, Benchmark) {\n  console.log('Starting. Tests take ~1 minute to run ...');\n\n  function testParseAndStringify() {\n    const suite = new Benchmark.Suite({\n      onError(event) {\n        console.error(event.target.error);\n      },\n    });\n\n    const BYTES = [\n      0x0f, 0x5a, 0xbc, 0xd1, 0xc1, 0x94, 0x47, 0xf3, 0x90, 0x5b, 0x2d, 0xf7, 0x26, 0x3a, 0x08,\n      0x4b,\n    ];\n\n    suite\n      .add('uuid.stringify()', function () {\n        uuid.stringify(BYTES);\n      })\n      .add('uuid.parse()', function () {\n        uuid.parse('0f5abcd1-c194-47f3-905b-2df7263a084b');\n      })\n      .on('cycle', function (event) {\n        console.log(event.target.toString());\n      })\n      .on('complete', function () {\n        console.log('---\\n');\n      })\n      .run();\n  }\n\n  function testGeneration() {\n    const array = new Array(16);\n\n    const suite = new Benchmark.Suite({\n      onError(event) {\n        console.error(event.target.error);\n      },\n    });\n\n    suite\n      .add('uuid.v1()', function () {\n        uuid.v1();\n      })\n      .add('uuid.v1() fill existing array', function () {\n        try {\n          uuid.v1(null, array, 0);\n        } catch {\n          // The spec (https://datatracker.ietf.org/doc/html/rfc9562#name-timestamp-considerations) defines that only 10M/s v1\n          // UUIDs can be generated on a single node. This library throws an error if we hit that limit\n          // (which can happen on modern hardware and modern Node.js versions).\n        }\n      })\n      .add('uuid.v4() using crypto.randomUUID', function () {\n        uuid.v4();\n      })\n      .add('uuid.v4() w/out crypto.randomUUID', function () {\n        uuid.v4({}); // passing an object instead of null bypasses native.randomUUID\n      })\n      .add('uuid.v4() fill existing array', function () {\n        uuid.v4(null, array, 0);\n      })\n      .add('crypto.randomUUID()', function () {\n        crypto.randomUUID();\n      })\n      .add('uuid.v5()', function () {\n        uuid.v5('hello.example.com', uuid.v5.DNS);\n      })\n      .add('uuid.v6()', function () {\n        uuid.v6();\n      })\n      .add('uuid.v7()', function () {\n        uuid.v7();\n      })\n      .add('uuid.v7() fill existing array', function () {\n        uuid.v7(null, array, 0);\n      })\n      .add('uuid.v7() with defined time', function () {\n        uuid.v7({\n          msecs: 1645557742000,\n        });\n      })\n      .on('cycle', function (event) {\n        console.log(event.target.toString());\n      })\n      .on('complete', function () {\n        console.log('Fastest is ' + this.filter('fastest').map('name'));\n        console.log('---\\n');\n      })\n      .run();\n  }\n\n  function testV6Conversion() {\n    const suite = new Benchmark.Suite({\n      onError(event) {\n        console.error(event.target.error);\n      },\n    });\n\n    const V1_ID = 'f1207660-21d2-11ef-8c4f-419efbd44d48';\n    const V6_ID = '1ef21d2f-1207-6660-8c4f-419efbd44d48';\n\n    suite\n      .add('uuid.v1ToV6()', function () {\n        uuid.v1ToV6(V1_ID);\n      })\n      .add('uuid.v6ToV1()', function () {\n        uuid.v6ToV1(V6_ID);\n      })\n      .on('cycle', function (event) {\n        console.log(event.target.toString());\n      })\n      .run();\n  }\n\n  testParseAndStringify();\n  testGeneration();\n  testV6Conversion();\n}\n"
  },
  {
    "path": "examples/benchmark/browser.js",
    "content": "import * as uuid from './node_modules/uuid/dist/index.js';\nimport './node_modules/lodash/lodash.js';\nimport './node_modules/benchmark/benchmark.js';\n\nimport benchmark from './benchmark.js';\n\nbenchmark(uuid, window.Benchmark);\n"
  },
  {
    "path": "examples/benchmark/node.js",
    "content": "import * as uuid from 'uuid';\nimport Benchmark from 'benchmark';\n\nimport benchmark from './benchmark.js';\n\nbenchmark(uuid, Benchmark);\n"
  },
  {
    "path": "examples/benchmark/package.json",
    "content": "{\n  \"name\": \"uuid-benchmark\",\n  \"version\": \"0.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"build\": \"true\",\n    \"start\": \"npm run build && npx http-server . -o\",\n    \"pretest\": \"rm -fr node_modules && npm install --no-package-lock\",\n    \"test\": \"node node.js\"\n  },\n  \"dependencies\": {\n    \"uuid\": \"file:../../.build/uuid.tgz\"\n  },\n  \"devDependencies\": {\n    \"benchmark\": \"^2.1.4\"\n  },\n  \"type\": \"module\"\n}\n"
  },
  {
    "path": "examples/browser-esmodules/README.md",
    "content": "# uuid example Browser with native ECMAScript Modules\n\n```\nnpm install\nnpm start\n```\n\nThen navigate to `example.html`.\n"
  },
  {
    "path": "examples/browser-esmodules/example.html",
    "content": "<!doctype html>\n<title>UUID esmodule native example</title>\n<p>Please open the Developer Console to view output</p>\n<script type=\"module\" src=\"example.js\"></script>\n"
  },
  {
    "path": "examples/browser-esmodules/example.js",
    "content": "import * as uuid from './node_modules/uuid/dist/index.js';\nimport {\n  MAX as MAX_UUID,\n  NIL as NIL_UUID,\n  parse as uuidParse,\n  stringify as uuidStringify,\n  validate as uuidValidate,\n  version as uuidVersion,\n  v1 as uuidv1,\n  v1ToV6 as uuidv1ToV6,\n  v3 as uuidv3,\n  v4 as uuidv4,\n  v5 as uuidv5,\n  v6 as uuidv6,\n  v6ToV1 as uuidv6ToV1,\n  v7 as uuidv7,\n} from './node_modules/uuid/dist/index.js';\n\n// Import attribute syntax is still awaiting finalization.   In the meantime we\n// use dynamic import to allows to specifyg both \"assert\" and \"with\" clauses.\n// See https://github.com/tc39/proposal-import-attributes\nconst pkg = await import('./node_modules/uuid/package.json', {\n  assert: { type: 'json' },\n  with: { type: 'json' },\n});\n\nconsole.log('pkg', pkg);\n\nconsole.log('uuidv1()', uuidv1());\n\nconsole.log('uuidv4()', uuidv4());\n\nconsole.log('uuidv7()', uuidv7());\n\n// ... using predefined DNS namespace (for domain names)\nconsole.log('uuidv3() DNS', uuidv3('hello.example.com', uuidv3.DNS));\n\n// ... using predefined URL namespace (for, well, URLs)\nconsole.log('uuidv3() URL', uuidv3('http://example.com/hello', uuidv3.URL));\n\n// ... using a custom namespace\n//\n// Note: Custom namespaces should be a UUID string specific to your application!\n// E.g. the one here was generated using this modules `uuid` CLI.\nconst MY_NAMESPACE = '55238d15-c926-4598-b49d-cf4e913ba13c';\nconsole.log('uuidv3() MY_NAMESPACE', uuidv3('Hello, World!', MY_NAMESPACE));\n\n// ... using predefined DNS namespace (for domain names)\nconsole.log('uuidv5() DNS', uuidv5('hello.example.com', uuidv5.DNS));\n\n// ... using predefined URL namespace (for, well, URLs)\nconsole.log('uuidv5() URL', uuidv5('http://example.com/hello', uuidv5.URL));\n\n// ... using a custom namespace\n//\n// Note: Custom namespaces should be a UUID string specific to your application!\n// E.g. the one here was generated using this modules `uuid` CLI.\n// const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';\nconsole.log('uuidv5() MY_NAMESPACE', uuidv5('Hello, World!', MY_NAMESPACE));\n\nconsole.log('uuidv6()', uuidv6());\n\n// v6 <-> v1 conversion\nconst V1_ID = 'f1207660-21d2-11ef-8c4f-419efbd44d48';\nconst V6_ID = '1ef21d2f-1207-6660-8c4f-419efbd44d48';\nconsole.log('uuidv1ToV6()', uuidv1ToV6(V1_ID));\nconsole.log('uuidv6ToV1()', uuidv6ToV1(V6_ID));\n\n// Utility functions\nconsole.log('NIL_UUID', NIL_UUID);\nconsole.log('MAX_UUID', MAX_UUID);\nconsole.log('uuidParse()', uuidParse(MY_NAMESPACE));\nconsole.log('uuidStringify()', uuidStringify(uuidParse(MY_NAMESPACE)));\nconsole.log('uuidValidate()', uuidValidate(MY_NAMESPACE));\nconsole.log('uuidVersion()', uuidVersion(MY_NAMESPACE));\n\nconsole.log('Same with default export');\n\nconsole.log('uuid.v1()', uuid.v1());\nconsole.log('uuid.v4()', uuid.v4());\nconsole.log('uuid.v7()', uuid.v7());\nconsole.log('uuid.v3() DNS', uuid.v3('hello.example.com', uuid.v3.DNS));\nconsole.log('uuid.v3() URL', uuid.v3('http://example.com/hello', uuid.v3.URL));\nconsole.log('uuid.v3() MY_NAMESPACE', uuid.v3('Hello, World!', MY_NAMESPACE));\nconsole.log('uuid.v5() DNS', uuid.v5('hello.example.com', uuid.v5.DNS));\nconsole.log('uuid.v5() URL', uuid.v5('http://example.com/hello', uuid.v5.URL));\nconsole.log('uuid.v5() MY_NAMESPACE', uuid.v5('Hello, World!', MY_NAMESPACE));\nconsole.log('uuid.v6()', uuid.v6());\n\nconsole.log('uuid.v1ToV6()', uuid.v1ToV6(V1_ID));\nconsole.log('uuid.v6ToV1()', uuid.v6ToV1(V6_ID));\n\nconsole.log('uuid.NIL', uuid.NIL);\nconsole.log('uuid.MAX', uuid.MAX);\nconsole.log('uuid.parse()', uuid.parse(MY_NAMESPACE));\nconsole.log('uuid.stringify()', uuid.stringify(uuid.parse(MY_NAMESPACE)));\nconsole.log('uuid.validate()', uuid.validate(MY_NAMESPACE));\nconsole.log('uuid.version()', uuid.version(MY_NAMESPACE));\n\n// Some tools like react-native need to introspect the package.json file\nconsole.log('pkg.name', pkg.name);\n"
  },
  {
    "path": "examples/browser-esmodules/package.json",
    "content": "{\n  \"name\": \"uuid-example-browser-esmodules\",\n  \"version\": \"0.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"build\": \"true\",\n    \"start\": \"npm run build && npx http-server . -o\"\n  },\n  \"dependencies\": {\n    \"uuid\": \"file:../../.build/uuid.tgz\"\n  }\n}\n"
  },
  {
    "path": "examples/browser-rollup/README.md",
    "content": "# uuid example Browser with rollup.js\n\n```\nnpm install\nnpm start\n```\n\nThen navigate to `example-*.html`.\n\nThe `example-v{1,4,7}.js` demonstrate that treeshaking works as expected:\n\n```\n$ du -sh dist/*\n 20K  dist/all.js\n8.0K  dist/v1.js\n4.0K  dist/v4.js\n4.0K  dist/v7.js\n```\n"
  },
  {
    "path": "examples/browser-rollup/example-all.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>UUID esmodule webpack example</title>\n  </head>\n  <body>\n    <script type=\"text/javascript\" src=\"./dist/all.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/browser-rollup/example-all.js",
    "content": "import * as uuid from 'uuid';\nimport {\n  MAX as MAX_UUID,\n  NIL as NIL_UUID,\n  parse as uuidParse,\n  stringify as uuidStringify,\n  validate as uuidValidate,\n  version as uuidVersion,\n  v1 as uuidv1,\n  v1ToV6 as uuidv1ToV6,\n  v3 as uuidv3,\n  v4 as uuidv4,\n  v5 as uuidv5,\n  v6 as uuidv6,\n  v6ToV1 as uuidv6ToV1,\n  v7 as uuidv7,\n} from 'uuid';\n\nimport testpage from '../utils/testpage';\n\ntestpage(function (addTest, done) {\n  addTest('Named exports');\n\n  addTest('uuidv1()', uuidv1());\n\n  addTest('uuidv4()', uuidv4());\n\n  addTest('uuidv7()', uuidv7());\n\n  // ... using predefined DNS namespace (for domain names)\n  addTest('uuidv3() DNS', uuidv3('hello.example.com', uuidv3.DNS));\n\n  // ... using predefined URL namespace (for, well, URLs)\n  addTest('uuidv3() URL', uuidv3('http://example.com/hello', uuidv3.URL));\n\n  // ... using a custom namespace\n  //\n  // Note: Custom namespaces should be a UUID string specific to your application!\n  // E.g. the one here was generated using this modules `uuid` CLI.\n  const MY_NAMESPACE = '55238d15-c926-4598-b49d-cf4e913ba13c';\n  addTest('uuidv3() MY_NAMESPACE', uuidv3('Hello, World!', MY_NAMESPACE));\n\n  // ... using predefined DNS namespace (for domain names)\n  addTest('uuidv5() DNS', uuidv5('hello.example.com', uuidv5.DNS));\n\n  // ... using predefined URL namespace (for, well, URLs)\n  addTest('uuidv5() URL', uuidv5('http://example.com/hello', uuidv5.URL));\n\n  // ... using a custom namespace\n  //\n  // Note: Custom namespaces should be a UUID string specific to your application!\n  // E.g. the one here was generated using this modules `uuid` CLI.\n  // const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';\n  addTest('uuidv5() MY_NAMESPACE', uuidv5('Hello, World!', MY_NAMESPACE));\n\n  addTest('uuidv6()', uuidv6());\n\n  // v6 <-> v1 conversion\n  const V1_ID = 'f1207660-21d2-11ef-8c4f-419efbd44d48';\n  const V6_ID = '1ef21d2f-1207-6660-8c4f-419efbd44d48';\n  addTest('uuidv1ToV6()', uuidv1ToV6(V1_ID));\n  addTest('uuidv6ToV1()', uuidv6ToV1(V6_ID));\n\n  // Utility functions\n  addTest('NIL_UUID', NIL_UUID);\n  addTest('MAX_UUID', MAX_UUID);\n  addTest('uuidParse()', uuidParse(MY_NAMESPACE));\n  addTest('uuidStringify()', uuidStringify(uuidParse(MY_NAMESPACE)));\n  addTest('uuidValidate()', uuidValidate(MY_NAMESPACE));\n  addTest('uuidVersion()', uuidVersion(MY_NAMESPACE));\n\n  addTest('Default export');\n\n  addTest('uuid.v1()', uuid.v1());\n  addTest('uuid.v4()', uuid.v4());\n  addTest('uuid.v7()', uuid.v7());\n  addTest('uuid.v3() DNS', uuid.v3('hello.example.com', uuid.v3.DNS));\n  addTest('uuid.v3() URL', uuid.v3('http://example.com/hello', uuid.v3.URL));\n  addTest('uuid.v3() MY_NAMESPACE', uuid.v3('Hello, World!', MY_NAMESPACE));\n  addTest('uuid.v5() DNS', uuid.v5('hello.example.com', uuid.v5.DNS));\n  addTest('uuid.v5() URL', uuid.v5('http://example.com/hello', uuid.v5.URL));\n  addTest('uuid.v5() MY_NAMESPACE', uuid.v5('Hello, World!', MY_NAMESPACE));\n  addTest('uuid.v6()', uuid.v6());\n\n  addTest('uuid.v1ToV6()', uuid.v1ToV6(V1_ID));\n  addTest('uuid.v6ToV1()', uuid.v6ToV1(V6_ID));\n\n  addTest('uuid.NIL', uuid.NIL);\n  addTest('uuid.MAX', uuid.MAX);\n  addTest('uuid.parse()', uuid.parse(MY_NAMESPACE));\n  addTest('uuid.stringify()', uuid.stringify(uuid.parse(MY_NAMESPACE)));\n  addTest('uuid.validate()', uuid.validate(MY_NAMESPACE));\n  addTest('uuid.version()', uuid.version(MY_NAMESPACE));\n\n  done();\n});\n"
  },
  {
    "path": "examples/browser-rollup/example-v1.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>UUID esmodule webpack example</title>\n  </head>\n  <body>\n    <script type=\"text/javascript\" src=\"./dist/v1.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/browser-rollup/example-v1.js",
    "content": "import { v1 as uuidv1 } from 'uuid';\n\nimport testpage from '../utils/testpage';\n\ntestpage(function (addTest, done) {\n  addTest('uuidv1()', uuidv1());\n  done();\n});\n"
  },
  {
    "path": "examples/browser-rollup/example-v4.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>UUID esmodule webpack example</title>\n  </head>\n  <body>\n    <script type=\"text/javascript\" src=\"./dist/v4.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/browser-rollup/example-v4.js",
    "content": "import { v4 as uuidv4 } from 'uuid';\n\nimport testpage from '../utils/testpage';\n\ntestpage(function (addTest, done) {\n  addTest('uuidv4()', uuidv4());\n  done();\n});\n"
  },
  {
    "path": "examples/browser-rollup/example-v7.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>UUID esmodule webpack example</title>\n  </head>\n\n  <body>\n    <script type=\"text/javascript\" src=\"./dist/v7.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/browser-rollup/example-v7.js",
    "content": "import { v7 as uuidv7 } from 'uuid';\n\nimport testpage from '../utils/testpage';\n\ntestpage(function (addTest, done) {\n  addTest('uuidv7()', uuidv7());\n  done();\n});\n"
  },
  {
    "path": "examples/browser-rollup/example.html",
    "content": "<!doctype html>\n<title>UUID esmodule webpack example</title>\n<p>Please open the Developer Console to view output</p>\n<script type=\"text/javascript\" src=\"./dist/v1.js\"></script>\n<script type=\"text/javascript\" src=\"./dist/v4.js\"></script>\n<script type=\"text/javascript\" src=\"./dist/v7.js\"></script>\n<script type=\"text/javascript\" src=\"./dist/all.js\"></script>\n"
  },
  {
    "path": "examples/browser-rollup/package.json",
    "content": "{\n  \"name\": \"uuid-example-browser-rollup\",\n  \"version\": \"0.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"build\": \"rm -fr node_modules && npm install --no-package-lock && rm -rf dist && rollup -c\",\n    \"start\": \"npm run build && npx http-server . -o\"\n  },\n  \"dependencies\": {\n    \"uuid\": \"file:../../.build/uuid.tgz\"\n  },\n  \"devDependencies\": {\n    \"@rollup/plugin-node-resolve\": \"^15.2.3\",\n    \"@rollup/plugin-terser\": \"0.4.4\",\n    \"rollup\": \"^4.19.0\"\n  }\n}\n"
  },
  {
    "path": "examples/browser-rollup/rollup.config.js",
    "content": "import { nodeResolve } from '@rollup/plugin-node-resolve';\nimport terser from '@rollup/plugin-terser';\n\nconst plugins = [nodeResolve({ browser: true }), terser()];\nexport default [\n  {\n    input: './example-all.js',\n    output: {\n      file: 'dist/all.js',\n      format: 'iife',\n      globals: { crypto: 'crypto' },\n    },\n    plugins,\n  },\n  {\n    input: './example-v1.js',\n    output: {\n      file: 'dist/v1.js',\n      format: 'iife',\n      globals: { crypto: 'crypto' },\n    },\n    plugins,\n  },\n  {\n    input: './example-v4.js',\n    output: {\n      file: 'dist/v4.js',\n      format: 'iife',\n      globals: { crypto: 'crypto' },\n    },\n    plugins,\n  },\n  {\n    input: './example-v7.js',\n    output: {\n      file: 'dist/v7.js',\n      format: 'iife',\n      globals: { crypto: 'crypto' },\n    },\n    plugins,\n  },\n\n  {\n    input: './size-v1.js',\n    output: {\n      file: 'dist/v1-size.js',\n      format: 'es',\n    },\n    plugins,\n  },\n  {\n    input: './size-v3.js',\n    output: {\n      file: 'dist/v3-size.js',\n      format: 'es',\n    },\n    plugins,\n  },\n  {\n    input: './size-v4.js',\n    output: {\n      file: 'dist/v4-size.js',\n      format: 'es',\n    },\n    plugins,\n  },\n  {\n    input: './size-v5.js',\n    output: {\n      file: 'dist/v5-size.js',\n      format: 'es',\n    },\n    plugins,\n  },\n  {\n    input: './size-v6.js',\n    output: {\n      file: 'dist/v6-size.js',\n      format: 'es',\n    },\n    plugins,\n  },\n  {\n    input: './size-v7.js',\n    output: {\n      file: 'dist/v7-size.js',\n      format: 'es',\n    },\n    plugins,\n  },\n];\n"
  },
  {
    "path": "examples/browser-rollup/size-v1.js",
    "content": "import { v1 as uuidv1 } from 'uuid';\n\nuuidv1();\n"
  },
  {
    "path": "examples/browser-rollup/size-v3.js",
    "content": "import { v3 as uuidv3 } from 'uuid';\n\nuuidv3();\n"
  },
  {
    "path": "examples/browser-rollup/size-v4.js",
    "content": "import { v4 as uuidv4 } from 'uuid';\n\nuuidv4();\n"
  },
  {
    "path": "examples/browser-rollup/size-v5.js",
    "content": "import { v5 as uuidv5 } from 'uuid';\n\nuuidv5();\n"
  },
  {
    "path": "examples/browser-rollup/size-v6.js",
    "content": "import { v6 as uuidv6 } from 'uuid';\n\nuuidv6();\n"
  },
  {
    "path": "examples/browser-rollup/size-v7.js",
    "content": "import { v7 as uuidv7 } from 'uuid';\n\nuuidv7();\n"
  },
  {
    "path": "examples/browser-webpack/README.md",
    "content": "# uuid example Browser with Webpack\n\n```\nnpm install\nnpm start\n```\n\nThen navigate to `example-*.html`.\n\nThe `example-v{1,4}.js` demonstrate that treeshaking works as expected (webpack output below):\n\n```\n Asset      Size  Chunks             Chunk Names\nall.js  8.54 KiB       0  [emitted]  all\n v1.js   2.6 KiB       1  [emitted]  v1\n v4.js     2 KiB       2  [emitted]  v4\n```\n"
  },
  {
    "path": "examples/browser-webpack/example-all.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>UUID esmodule webpack example</title>\n  </head>\n  <body>\n    <script type=\"text/javascript\" src=\"./dist/all.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/browser-webpack/example-all.js",
    "content": "import * as uuid from 'uuid';\nimport {\n  MAX as MAX_UUID,\n  NIL as NIL_UUID,\n  parse as uuidParse,\n  stringify as uuidStringify,\n  validate as uuidValidate,\n  version as uuidVersion,\n  v1 as uuidv1,\n  v1ToV6 as uuidv1ToV6,\n  v3 as uuidv3,\n  v4 as uuidv4,\n  v5 as uuidv5,\n  v6 as uuidv6,\n  v6ToV1 as uuidv6ToV1,\n  v7 as uuidv7,\n} from 'uuid';\n\nimport testpage from '../utils/testpage';\n\ntestpage(function (addTest, done) {\n  addTest('Named exports');\n\n  addTest('uuidv1()', uuidv1());\n\n  addTest('uuidv4()', uuidv4());\n\n  addTest('uuidv7()', uuidv7());\n\n  // ... using predefined DNS namespace (for domain names)\n  addTest('uuidv3() DNS', uuidv3('hello.example.com', uuidv3.DNS));\n\n  // ... using predefined URL namespace (for, well, URLs)\n  addTest('uuidv3() URL', uuidv3('http://example.com/hello', uuidv3.URL));\n\n  // ... using a custom namespace\n  //\n  // Note: Custom namespaces should be a UUID string specific to your application!\n  // E.g. the one here was generated using this modules `uuid` CLI.\n  const MY_NAMESPACE = '55238d15-c926-4598-b49d-cf4e913ba13c';\n  addTest('uuidv3() MY_NAMESPACE', uuidv3('Hello, World!', MY_NAMESPACE));\n\n  // ... using predefined DNS namespace (for domain names)\n  addTest('uuidv5() DNS', uuidv5('hello.example.com', uuidv5.DNS));\n\n  // ... using predefined URL namespace (for, well, URLs)\n  addTest('uuidv5() URL', uuidv5('http://example.com/hello', uuidv5.URL));\n\n  // ... using a custom namespace\n  //\n  // Note: Custom namespaces should be a UUID string specific to your application!\n  // E.g. the one here was generated using this modules `uuid` CLI.\n  // const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';\n  addTest('uuidv5() MY_NAMESPACE', uuidv5('Hello, World!', MY_NAMESPACE));\n\n  addTest('uuidv6()', uuidv6());\n\n  // v6 <-> v1 conversion\n  const V1_ID = 'f1207660-21d2-11ef-8c4f-419efbd44d48';\n  const V6_ID = '1ef21d2f-1207-6660-8c4f-419efbd44d48';\n  addTest('uuidv1ToV6()', uuidv1ToV6(V1_ID));\n  addTest('uuidv6ToV1()', uuidv6ToV1(V6_ID));\n\n  // Utility functions\n  addTest('NIL_UUID', NIL_UUID);\n  addTest('MAX_UUID', MAX_UUID);\n  addTest('uuidParse()', uuidParse(MY_NAMESPACE));\n  addTest('uuidStringify()', uuidStringify(uuidParse(MY_NAMESPACE)));\n  addTest('uuidValidate()', uuidValidate(MY_NAMESPACE));\n  addTest('uuidVersion()', uuidVersion(MY_NAMESPACE));\n\n  addTest('Default export');\n\n  addTest('uuid.v1()', uuid.v1());\n  addTest('uuid.v4()', uuid.v4());\n  addTest('uuid.v7()', uuid.v7());\n  addTest('uuid.v3() DNS', uuid.v3('hello.example.com', uuid.v3.DNS));\n  addTest('uuid.v3() URL', uuid.v3('http://example.com/hello', uuid.v3.URL));\n  addTest('uuid.v3() MY_NAMESPACE', uuid.v3('Hello, World!', MY_NAMESPACE));\n  addTest('uuid.v5() DNS', uuid.v5('hello.example.com', uuid.v5.DNS));\n  addTest('uuid.v5() URL', uuid.v5('http://example.com/hello', uuid.v5.URL));\n  addTest('uuid.v5() MY_NAMESPACE', uuid.v5('Hello, World!', MY_NAMESPACE));\n  addTest('uuid.v6()', uuid.v6());\n\n  addTest('uuid.v1ToV6()', uuid.v1ToV6(V1_ID));\n  addTest('uuid.v6ToV1()', uuid.v6ToV1(V6_ID));\n\n  addTest('uuid.NIL', uuid.NIL);\n  addTest('uuid.MAX', uuid.MAX);\n  addTest('uuid.parse()', uuid.parse(MY_NAMESPACE));\n  addTest('uuid.stringify()', uuid.stringify(uuid.parse(MY_NAMESPACE)));\n  addTest('uuid.validate()', uuid.validate(MY_NAMESPACE));\n  addTest('uuid.version()', uuid.version(MY_NAMESPACE));\n\n  done();\n});\n"
  },
  {
    "path": "examples/browser-webpack/example-v1.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>UUID esmodule webpack example</title>\n  </head>\n  <body>\n    <script type=\"text/javascript\" src=\"./dist/v1.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/browser-webpack/example-v1.js",
    "content": "import { v1 as uuidv1 } from 'uuid';\n\nimport testpage from '../utils/testpage';\n\ntestpage(function (addTest, done) {\n  addTest('uuidv1()', uuidv1());\n\n  done();\n});\n"
  },
  {
    "path": "examples/browser-webpack/example-v4.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>UUID esmodule webpack example</title>\n  </head>\n  <body>\n    <script type=\"text/javascript\" src=\"./dist/v4.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/browser-webpack/example-v4.js",
    "content": "import { v4 as uuidv4 } from 'uuid';\n\nimport testpage from '../utils/testpage';\n\ntestpage(function (addTest, done) {\n  addTest('uuidv4()', uuidv4());\n\n  done();\n});\n"
  },
  {
    "path": "examples/browser-webpack/example-v7.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <title>UUID esmodule webpack example</title>\n  </head>\n\n  <body>\n    <script type=\"text/javascript\" src=\"./dist/v7.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/browser-webpack/example-v7.js",
    "content": "import { v7 as uuidv7 } from 'uuid';\n\nimport testpage from '../utils/testpage';\n\ntestpage(function (addTest, done) {\n  addTest('uuidv7()', uuidv7());\n\n  done();\n});\n"
  },
  {
    "path": "examples/browser-webpack/example.html",
    "content": "<!doctype html>\n<title>UUID esmodule webpack example</title>\n<p>Please open the Developer Console to view output</p>\n<script type=\"text/javascript\" src=\"./dist/v1.js\"></script>\n<script type=\"text/javascript\" src=\"./dist/v4.js\"></script>\n<script type=\"text/javascript\" src=\"./dist/v7.js\"></script>\n<script type=\"text/javascript\" src=\"./dist/all.js\"></script>\n"
  },
  {
    "path": "examples/browser-webpack/package.json",
    "content": "{\n  \"name\": \"uuid-example-browser-webpack\",\n  \"version\": \"0.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"build\": \"rm -fr node_modules && npm install --no-package-lock && rm -rf dist && webpack\",\n    \"start\": \"npm run build && npx http-server . -o\"\n  },\n  \"dependencies\": {\n    \"uuid\": \"file:../../.build/uuid.tgz\"\n  },\n  \"devDependencies\": {\n    \"webpack\": \"5.93.0\",\n    \"webpack-cli\": \"5.1.4\"\n  }\n}\n"
  },
  {
    "path": "examples/browser-webpack/size-v1.js",
    "content": "import { v1 as uuidv1 } from 'uuid';\n\nuuidv1();\n"
  },
  {
    "path": "examples/browser-webpack/size-v3.js",
    "content": "import { v3 as uuidv3 } from 'uuid';\n\nuuidv3();\n"
  },
  {
    "path": "examples/browser-webpack/size-v4.js",
    "content": "import { v4 as uuidv4 } from 'uuid';\n\nuuidv4();\n"
  },
  {
    "path": "examples/browser-webpack/size-v5.js",
    "content": "import { v5 as uuidv5 } from 'uuid';\n\nuuidv5();\n"
  },
  {
    "path": "examples/browser-webpack/size-v6.js",
    "content": "import { v6 as uuidv6 } from 'uuid';\n\nuuidv6();\n"
  },
  {
    "path": "examples/browser-webpack/size-v7.js",
    "content": "import { v7 as uuidv7 } from 'uuid';\n\nuuidv7();\n"
  },
  {
    "path": "examples/browser-webpack/webpack.config.js",
    "content": "module.exports = {\n  resolve: {\n    extensions: ['*', '.js'],\n    fallback: { crypto: false },\n  },\n  entry: {\n    all: './example-all.js',\n    v1: './example-v1.js',\n    v4: './example-v4.js',\n    v7: './example-v7.js',\n\n    'v1-size': './size-v1.js',\n    'v3-size': './size-v3.js',\n    'v4-size': './size-v4.js',\n    'v5-size': './size-v5.js',\n    'v6-size': './size-v6.js',\n    'v7-size': './size-v7.js',\n  },\n  // Webpack now produces builds that are incompatible with IE11:\n  // https://webpack.js.org/migrate/5/#turn-off-es2015-syntax-in-runtime-code-if-necessary\n  target: ['web', 'es5'],\n  output: {\n    filename: '[name].js',\n  },\n  mode: 'production',\n};\n"
  },
  {
    "path": "examples/node-esmodules/README.md",
    "content": "# uuid example Node.js ESModules\n\n```\nnpm install\nnpm test\n```\n"
  },
  {
    "path": "examples/node-esmodules/example.mjs",
    "content": "import * as uuid from 'uuid';\nimport {\n  MAX as MAX_UUID,\n  NIL as NIL_UUID,\n  parse as uuidParse,\n  stringify as uuidStringify,\n  validate as uuidValidate,\n  version as uuidVersion,\n  v1 as uuidv1,\n  v1ToV6 as uuidv1ToV6,\n  v3 as uuidv3,\n  v4 as uuidv4,\n  v5 as uuidv5,\n  v6 as uuidv6,\n  v6ToV1 as uuidv6ToV1,\n  v7 as uuidv7,\n} from 'uuid';\n\n// Import attribute syntax is still awaiting finalization.   In the meantime we\n// use dynamic import to allows to specifyg both \"assert\" and \"with\" clauses.\n// See https://github.com/tc39/proposal-import-attributes\nconst pkg = await import('uuid/package.json', { assert: { type: 'json' }, with: { type: 'json' } });\n\nconsole.log('uuidv1()', uuidv1());\n\nconsole.log('uuidv4()', uuidv4());\n\nconsole.log('uuidv7()', uuidv7());\n\n// ... using predefined DNS namespace (for domain names)\nconsole.log('uuidv3() DNS', uuidv3('hello.example.com', uuidv3.DNS));\n\n// ... using predefined URL namespace (for, well, URLs)\nconsole.log('uuidv3() URL', uuidv3('http://example.com/hello', uuidv3.URL));\n\n// ... using a custom namespace\n//\n// Note: Custom namespaces should be a UUID string specific to your application!\n// E.g. the one here was generated using this modules `uuid` CLI.\nconst MY_NAMESPACE = '55238d15-c926-4598-b49d-cf4e913ba13c';\nconsole.log('uuidv3() MY_NAMESPACE', uuidv3('Hello, World!', MY_NAMESPACE));\n\n// ... using predefined DNS namespace (for domain names)\nconsole.log('uuidv5() DNS', uuidv5('hello.example.com', uuidv5.DNS));\n\n// ... using predefined URL namespace (for, well, URLs)\nconsole.log('uuidv5() URL', uuidv5('http://example.com/hello', uuidv5.URL));\n\n// ... using a custom namespace\n//\n// Note: Custom namespaces should be a UUID string specific to your application!\n// E.g. the one here was generated using this modules `uuid` CLI.\n// const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';\nconsole.log('uuidv5() MY_NAMESPACE', uuidv5('Hello, World!', MY_NAMESPACE));\n\nconsole.log('uuidv6()', uuidv6());\n\n// v6 <-> v1 conversion\nconst V1_ID = 'f1207660-21d2-11ef-8c4f-419efbd44d48';\nconst V6_ID = '1ef21d2f-1207-6660-8c4f-419efbd44d48';\nconsole.log('uuidv1ToV6()', uuidv1ToV6(V1_ID));\nconsole.log('uuidv6ToV1()', uuidv6ToV1(V6_ID));\n\n// Utility functions\nconsole.log('NIL_UUID', NIL_UUID);\nconsole.log('MAX_UUID', MAX_UUID);\nconsole.log('uuidParse()', uuidParse(MY_NAMESPACE));\nconsole.log('uuidStringify()', uuidStringify(uuidParse(MY_NAMESPACE)));\nconsole.log('uuidValidate()', uuidValidate(MY_NAMESPACE));\nconsole.log('uuidVersion()', uuidVersion(MY_NAMESPACE));\n\nconsole.log('Same with default export');\n\nconsole.log('uuid.v1()', uuid.v1());\nconsole.log('uuid.v4()', uuid.v4());\nconsole.log('uuid.v7()', uuid.v7());\nconsole.log('uuid.v3() DNS', uuid.v3('hello.example.com', uuid.v3.DNS));\nconsole.log('uuid.v3() URL', uuid.v3('http://example.com/hello', uuid.v3.URL));\nconsole.log('uuid.v3() MY_NAMESPACE', uuid.v3('Hello, World!', MY_NAMESPACE));\nconsole.log('uuid.v5() DNS', uuid.v5('hello.example.com', uuid.v5.DNS));\nconsole.log('uuid.v5() URL', uuid.v5('http://example.com/hello', uuid.v5.URL));\nconsole.log('uuid.v5() MY_NAMESPACE', uuid.v5('Hello, World!', MY_NAMESPACE));\nconsole.log('uuid.v6()', uuid.v6());\n\nconsole.log('uuid.v1ToV6()', uuid.v1ToV6(V1_ID));\nconsole.log('uuid.v6ToV1()', uuid.v6ToV1(V6_ID));\n\nconsole.log('uuid.NIL', uuid.NIL);\nconsole.log('uuid.MAX', uuid.MAX);\nconsole.log('uuid.parse()', uuid.parse(MY_NAMESPACE));\nconsole.log('uuid.stringify()', uuid.stringify(uuid.parse(MY_NAMESPACE)));\nconsole.log('uuid.validate()', uuid.validate(MY_NAMESPACE));\nconsole.log('uuid.version()', uuid.version(MY_NAMESPACE));\n\n// Some tools like react-native need to introspect the package.json file\nconsole.log('pkg.name', pkg.default.name);\n"
  },
  {
    "path": "examples/node-esmodules/package.json",
    "content": "{\n  \"name\": \"uuid-example-node-esmodules\",\n  \"version\": \"0.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"test:package\": \"( node --version | grep -vq 'v18' ) || ( node package.mjs )\",\n    \"test:example\": \"node example.mjs\",\n    \"pretest\": \"rm -fr node_modules && npm install --no-package-lock\",\n    \"test\": \"npm-run-all test:*\"\n  },\n  \"dependencies\": {\n    \"uuid\": \"file:../../.build/uuid.tgz\"\n  }\n}\n"
  },
  {
    "path": "examples/node-esmodules/package.mjs",
    "content": "import pkg from 'uuid/package.json' assert { type: 'json' };\n\n// Some tools like react-native need to introspect the package.json file\nconsole.log('pkg.name', pkg.name);\n"
  },
  {
    "path": "examples/node-jest/README.md",
    "content": "# uuid example Node.js Jest\n\n```\nnpm install\nnpm test\n```\n"
  },
  {
    "path": "examples/node-jest/jsdom.test.js",
    "content": "/** @jest-environment jsdom */\nimport * as uuid from 'uuid';\n\ntest('uuidv4()', () => {\n  const val = uuid.v4();\n  expect(uuid.version(val)).toBe(4);\n});\n\ntest('uuidv7()', () => {\n  const val = uuid.v7();\n  expect(uuid.version(val)).toBe(7);\n});\n"
  },
  {
    "path": "examples/node-jest/node.test.js",
    "content": "import * as uuid from 'uuid';\n\ntest('uuidv4()', () => {\n  const val = uuid.v4();\n  expect(uuid.version(val)).toBe(4);\n});\n\ntest('uuidv7()', () => {\n  const val = uuid.v7();\n  expect(uuid.version(val)).toBe(7);\n});\n"
  },
  {
    "path": "examples/node-jest/package.json",
    "content": "{\n  \"name\": \"uuid-example-node-jest\",\n  \"version\": \"0.0.0\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"pretest\": \"rm -fr node_modules && npm install --no-package-lock\",\n    \"test\": \"NODE_OPTIONS=\\\"--experimental-vm-modules\\\" jest\"\n  },\n  \"dependencies\": {\n    \"uuid\": \"file:../../.build/uuid.tgz\"\n  },\n  \"devDependencies\": {\n    \"jest\": \"30.0.2\",\n    \"jest-environment-jsdom\": \"30.0.2\"\n  }\n}\n"
  },
  {
    "path": "examples/node-webpack/README.md",
    "content": "# uuid example Node.js with Webpack\n\n```\nnpm install\nnpm test\n```\n\nThis will run webpack and execute the resulting bundles in `./dist`.\n"
  },
  {
    "path": "examples/node-webpack/example-all.js",
    "content": "import * as uuid from 'uuid';\nimport { v1 as uuidv1, v3 as uuidv3, v4 as uuidv4, v5 as uuidv5 } from 'uuid';\n\nconsole.log('uuidv1()', uuidv1());\nconsole.log('uuidv4()', uuidv4());\n\n// ... using predefined DNS namespace (for domain names)\nconsole.log('uuidv3() DNS', uuidv3('hello.example.com', uuidv3.DNS));\n\n// ... using predefined URL namespace (for, well, URLs)\nconsole.log('uuidv3() URL', uuidv3('http://example.com/hello', uuidv3.URL));\n\n// ... using a custom namespace\n//\n// Note: Custom namespaces should be a UUID string specific to your application!\n// E.g. the one here was generated using this modules `uuid` CLI.\nconst MY_NAMESPACE = '55238d15-c926-4598-b49d-cf4e913ba13c';\nconsole.log('uuidv3() MY_NAMESPACE', uuidv3('Hello, World!', MY_NAMESPACE));\n\n// ... using predefined DNS namespace (for domain names)\nconsole.log('uuidv5() DNS', uuidv5('hello.example.com', uuidv5.DNS));\n\n// ... using predefined URL namespace (for, well, URLs)\nconsole.log('uuidv5() URL', uuidv5('http://example.com/hello', uuidv5.URL));\n\n// ... using a custom namespace\n//\n// Note: Custom namespaces should be a UUID string specific to your application!\n// E.g. the one here was generated using this modules `uuid` CLI.\n// const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';\nconsole.log('uuidv5() MY_NAMESPACE', uuidv5('Hello, World!', MY_NAMESPACE));\n\nconsole.log('Same with default export');\n\nconsole.log('uuid.v1()', uuid.v1());\nconsole.log('uuid.v4()', uuid.v4());\nconsole.log('uuid.v3() DNS', uuid.v3('hello.example.com', uuid.v3.DNS));\nconsole.log('uuid.v3() URL', uuid.v3('http://example.com/hello', uuid.v3.URL));\nconsole.log('uuid.v3() MY_NAMESPACE', uuid.v3('Hello, World!', MY_NAMESPACE));\nconsole.log('uuid.v5() DNS', uuid.v5('hello.example.com', uuid.v5.DNS));\nconsole.log('uuid.v5() URL', uuid.v5('http://example.com/hello', uuid.v5.URL));\nconsole.log('uuid.v5() MY_NAMESPACE', uuid.v5('Hello, World!', MY_NAMESPACE));\n"
  },
  {
    "path": "examples/node-webpack/example-v1.js",
    "content": "import { v1 as uuidv1 } from 'uuid';\n\nconsole.log('uuidv1()', uuidv1());\n"
  },
  {
    "path": "examples/node-webpack/example-v4.js",
    "content": "import { v4 as uuidv4 } from 'uuid';\n\nconsole.log('uuidv4()', uuidv4());\n"
  },
  {
    "path": "examples/node-webpack/example-v7.js",
    "content": "import { v7 as uuidv7 } from 'uuid';\n\nconsole.log('uuidv7()', uuidv7());\n"
  },
  {
    "path": "examples/node-webpack/package.json",
    "content": "{\n  \"name\": \"uuid-example-node-webpack\",\n  \"version\": \"0.0.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"build\": \"rm -rf dist && webpack\",\n    \"pretest\": \"rm -fr node_modules && npm install --no-package-lock\",\n    \"test\": \"npm run build && node dist/v1.js && node dist/v4.js && node dist/v7.js && node dist/all.js\"\n  },\n  \"dependencies\": {\n    \"uuid\": \"file:../../.build/uuid.tgz\"\n  },\n  \"devDependencies\": {\n    \"webpack\": \"^5.74.0\",\n    \"webpack-cli\": \"^4.10.0\"\n  }\n}\n"
  },
  {
    "path": "examples/node-webpack/webpack.config.js",
    "content": "module.exports = {\n  resolve: {\n    extensions: ['*', '.js'],\n  },\n  entry: {\n    all: './example-all.js',\n    v1: './example-v1.js',\n    v4: './example-v4.js',\n    v7: './example-v7.js',\n  },\n  output: {\n    filename: '[name].js',\n  },\n  mode: 'production',\n  target: 'node',\n};\n"
  },
  {
    "path": "examples/typescript/README.md",
    "content": "# uuid test for typescript support (not really an example)\n\n```\nnpm install\nnpm test\n```\n\nThis runs `tsc` using the oldest version of TypeScript supported by this project"
  },
  {
    "path": "examples/typescript/buffer.test.ts",
    "content": "/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport { v1 } from 'uuid';\n\nv1(undefined, new Uint8Array(16)) satisfies Uint8Array;\nv1(undefined, Buffer.alloc(16)) satisfies Buffer;\n\n// @ts-expect-error\nv1(undefined, new Uint8Array(16)) satisfies Buffer;\n"
  },
  {
    "path": "examples/typescript/index.ts",
    "content": "import * as uuid from 'uuid';\n\nconsole.log(uuid);\n"
  },
  {
    "path": "examples/typescript/package.json",
    "content": "{\n  \"dependencies\": {\n    \"uuid\": \"file:../../.build/uuid.tgz\"\n  },\n  \"scripts\": {\n    \"pretest\": \"rm -fr node_modules && npm install --no-package-lock\",\n    \"test\": \"npx -y --package=typescript@5.0.4 -- tsc --noEmit\"\n  }\n}\n"
  },
  {
    "path": "examples/typescript/tsconfig.json",
    "content": "{}\n"
  },
  {
    "path": "examples/utils/testpage.js",
    "content": "export default function test(callback) {\n  const style = document.createElement('style');\n  style.appendChild(\n    document.createTextNode(\n      [\n        'body {font-family: monospace;}',\n        'dt, dd {display: inline-block; margin: 0;}',\n        'dt {min-width: 15em;}',\n      ].join('\\n')\n    )\n  );\n  document.body.appendChild(style);\n\n  function addTest(title, result) {\n    // join() result if it's  array-like\n    if (result instanceof Uint8Array || Array.isArray(result)) {\n      result = Array.prototype.join.apply(result);\n    }\n\n    let el;\n    if (result === undefined) {\n      el = document.createElement('h2');\n      el.innerHTML = title;\n    } else {\n      el = document.createElement('div');\n      el.className = 'test_result';\n      el.innerHTML = '<dt>' + title + '</dt>: <dd>' + result + '</dd>';\n    }\n\n    document.body.appendChild(el);\n  }\n\n  function done() {\n    const div = document.createElement('h2');\n    div.id = 'done';\n    document.body.appendChild(div);\n  }\n\n  window.onload = function () {\n    callback(addTest, done);\n  };\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"uuid\",\n  \"version\": \"13.0.0\",\n  \"description\": \"RFC9562 UUIDs\",\n  \"type\": \"module\",\n  \"funding\": [\n    \"https://github.com/sponsors/broofa\",\n    \"https://github.com/sponsors/ctavan\"\n  ],\n  \"commitlint\": {\n    \"extends\": [\n      \"@commitlint/config-conventional\"\n    ]\n  },\n  \"keywords\": [\n    \"uuid\",\n    \"guid\",\n    \"rfc4122\",\n    \"rfc9562\"\n  ],\n  \"license\": \"MIT\",\n  \"bin\": {\n    \"uuid\": \"./dist-node/bin/uuid\"\n  },\n  \"sideEffects\": false,\n  \"types\": \"./dist/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"node\": \"./dist-node/index.js\",\n      \"default\": \"./dist/index.js\"\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"files\": [\n    \"dist\",\n    \"dist-node\",\n    \"!**/test\"\n  ],\n  \"devDependencies\": {\n    \"@babel/eslint-parser\": \"7.27.1\",\n    \"@commitlint/cli\": \"19.8.0\",\n    \"@commitlint/config-conventional\": \"19.8.0\",\n    \"@eslint/js\": \"9.26.0\",\n    \"bundlewatch\": \"0.4.1\",\n    \"commander\": \"13.1.0\",\n    \"eslint\": \"9.26.0\",\n    \"eslint-config-prettier\": \"10.1.2\",\n    \"eslint-plugin-prettier\": \"5.4.0\",\n    \"globals\": \"16.0.0\",\n    \"husky\": \"9.1.7\",\n    \"jest\": \"29.7.0\",\n    \"lint-staged\": \"15.5.2\",\n    \"neostandard\": \"0.12.1\",\n    \"npm-run-all\": \"4.1.5\",\n    \"prettier\": \"3.5.3\",\n    \"release-please\": \"17.0.0\",\n    \"runmd\": \"1.4.1\",\n    \"standard-version\": \"9.5.0\",\n    \"typescript\": \"5.2.2\",\n    \"typescript-eslint\": \"8.32.0\"\n  },\n  \"optionalDevDependencies\": {\n    \"@wdio/browserstack-service\": \"9.2.1\",\n    \"@wdio/cli\": \"9.2.1\",\n    \"@wdio/jasmine-framework\": \"9.2.1\",\n    \"@wdio/local-runner\": \"9.2.1\",\n    \"@wdio/spec-reporter\": \"9.1.3\",\n    \"@wdio/static-server-service\": \"9.1.3\"\n  },\n  \"scripts\": {\n    \"build\": \"./scripts/build.sh\",\n    \"build:watch\": \"tsc --watch -p tsconfig.json\",\n    \"bundlewatch\": \"npm run pretest:browser && bundlewatch --config bundlewatch.config.json\",\n    \"docs:diff\": \"npm run docs && git diff --quiet -I \\\"[0-9a-f-]{36}\\\" README.md\",\n    \"docs\": \"npm run build && npx runmd --output=README.md README_js.md\",\n    \"eslint:check\": \"eslint src/ test/ examples/ *.[jt]s\",\n    \"eslint:fix\": \"eslint --fix src/ test/ examples/ *.[jt]s\",\n    \"examples:browser:rollup:build\": \"cd examples/browser-rollup && npm run build\",\n    \"examples:browser:webpack:build\": \"cd examples/browser-webpack && npm run build\",\n    \"examples:node:esmodules:test\": \"cd examples/node-esmodules && npm test\",\n    \"examples:node:jest:test\": \"cd examples/node-jest && npm test\",\n    \"examples:node:typescript:test\": \"cd examples/typescript && npm test\",\n    \"lint\": \"npm run eslint:check && npm run prettier:check\",\n    \"md\": \"runmd --watch --output=README.md README_js.md\",\n    \"prepack\": \"npm run build -- --no-pack\",\n    \"prepare\": \"husky\",\n    \"prepublishOnly\": \"npm run build\",\n    \"pretest:benchmark\": \"npm run build\",\n    \"pretest:browser\": \"./scripts/iodd && npm run build && npm-run-all --parallel examples:browser:**\",\n    \"pretest:node\": \"npm run build\",\n    \"pretest\": \"npm run build\",\n    \"prettier:check\": \"prettier --check .\",\n    \"prettier:fix\": \"prettier --write .\",\n    \"release\": \"standard-version --no-verify\",\n    \"test:benchmark\": \"cd examples/benchmark && npm test\",\n    \"test:browser\": \"wdio run ./wdio.conf.js\",\n    \"test:node\": \"npm-run-all --parallel examples:node:**\",\n    \"test:watch\": \"node --test --enable-source-maps --watch dist-node/test/*.js\",\n    \"test\": \"node --test --enable-source-maps dist-node/test/*.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/uuidjs/uuid.git\"\n  },\n  \"lint-staged\": {\n    \"*\": [\n      \"prettier --no-error-on-unmatched-pattern --write\"\n    ],\n    \"*.{js,jsx}\": [\n      \"eslint --no-error-on-unmatched-pattern --fix\"\n    ]\n  },\n  \"standard-version\": {\n    \"scripts\": {\n      \"postchangelog\": \"prettier --write CHANGELOG.md\"\n    }\n  },\n  \"packageManager\": \"npm@11.3.0\"\n}\n"
  },
  {
    "path": "prettier.config.js",
    "content": "export default {\n  arrowParens: 'always',\n  printWidth: 100,\n  proseWrap: 'never',\n  singleQuote: true,\n  trailingComma: 'es5',\n};\n"
  },
  {
    "path": "scripts/build.sh",
    "content": "#!/bin/bash -eu\n\n# This script generates 4 builds, as follows:\n# - dist: ESM build for the Browser\n# - dist-node: ESM build for Node.js\n#\n# Note: that the \"preferred\" build for testing (local and CI) is the ESM build,\n# except where we specifically test the other builds\n\nset -e # exit on error\n\n# Change to project root\nROOT=$(builtin cd $(pwd)/$(dirname \"$0\")/..; pwd)\n\n# Prep TS output dir\nDIST_DIR=\"$ROOT/dist\"\nNODE_DIST_DIR=\"$ROOT/dist-node\"\necho \"Building in $DIST_DIR and $NODE_DIST_DIR\"\n\ncd \"$ROOT\" || exit 1\n\n# Remove old builds\nrm -rf $DIST_DIR*\n\n# Make default dist dir\nmkdir -p \"$DIST_DIR\"\n\n# Compile typescript\necho \"Compiling TypeScript files to $NODE_DIST_DIR\"\ntsc -p tsconfig.json\n\n# Clone files for node builds\ncp -pr \"$DIST_DIR\" \"$NODE_DIST_DIR\"\n\n# Remove browser files in node build\nfor FILE in ${NODE_DIST_DIR}/*-browser*; do\n  rm -f $FILE\ndone\n\n# Move browser files into place for default build\n(\n  cd \"$DIST_DIR\"\n\n  for FILE in *-browser*;do\n    mv \"$FILE\" \"${FILE/-browser/}\"\n  done\n)\n\n# Remove type definition files where they're not needed\n(\n  cd \"$NODE_DIST_DIR\"\n  find . -name '*.d.ts' -exec rm -f {} \\;\n)\n\n# Copy bin files into place\ncp -pr \"$ROOT/src/bin\" \"$NODE_DIST_DIR\"\n\nif [ \"${1-}\" != \"--no-pack\" ]; then\n  # Prep tarball dir\n  BUILD_DIR=\"$ROOT/.build\"\n  rm -rf \"$BUILD_DIR\"\n  mkdir -p \"$BUILD_DIR\"\n\n  # Create tarball for local installation (in tests and examples)\n  echo \"Packing tarball\"\n  npm pack --pack-destination \"$BUILD_DIR\" > /dev/null 2>&1\n  mv $BUILD_DIR/uuid-*.tgz $BUILD_DIR/uuid.tgz\nfi\n\necho \"-- fin --\""
  },
  {
    "path": "scripts/iodd",
    "content": "#!/usr/bin/env node\n\nimport { program } from 'commander';\nimport { spawn } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\n\nprogram\n  .name('iodd')\n  .description(\n    '(I)nstall (o)ptional (d)ev (d)ependencies from package.json#optionalDevDependencies'\n  )\n  .option('-v, --verbose', 'Output npm install output to stdout/stderr')\n  .option('-r, --required', 'Exit with non-zero code if dependencies fail to install')\n  .argument('[packagePath]', 'Path to package.json file', './package.json')\n  .action(main);\n\nasync function main(packagePath, options) {\n  // Get list of optional dependencies from package.json\n  const json = await fs.readFile(path.join(process.cwd(), packagePath));\n  const packageJson = JSON.parse(json);\n  const { optionalDevDependencies: deps } = packageJson;\n\n  if (!deps) {\n    console.error(`No optional dependencies found in ${packagePath}`);\n    process.exit(1);\n  }\n\n  const packageRefs = Object.entries(deps).map(([name, version]) => `${name}@${version}`);\n\n  // Install optional dependencies with child_process running npm\n  const args = ['install', '--no-save', ...packageRefs];\n  console.log('Running: ', 'npm', args.join(' '));\n\n  const cp = spawn('npm', args);\n\n  if (options.verbose) {\n    cp.stdout.pipe(process.stdout);\n    cp.stderr.pipe(process.stderr);\n  }\n\n  const exitCode = await new Promise((resolve) => {\n    cp.on('close', resolve);\n  });\n\n  if (exitCode !== 0) {\n    console.error('Dependencies failed to install');\n\n    if (options.required) {\n      process.exit(exitCode);\n    }\n  }\n}\n\nprogram.parseAsync();\n"
  },
  {
    "path": "src/bin/uuid",
    "content": "#!/usr/bin/env node\nimport '../uuid-bin.js';\n"
  },
  {
    "path": "src/index.ts",
    "content": "export type * from './types.js';\nexport { default as MAX } from './max.js';\nexport { default as NIL } from './nil.js';\nexport { default as parse } from './parse.js';\nexport { default as stringify } from './stringify.js';\nexport { default as v1 } from './v1.js';\nexport { default as v1ToV6 } from './v1ToV6.js';\nexport { default as v3 } from './v3.js';\nexport { default as v4 } from './v4.js';\nexport { default as v5 } from './v5.js';\nexport { default as v6 } from './v6.js';\nexport { default as v6ToV1 } from './v6ToV1.js';\nexport { default as v7 } from './v7.js';\nexport { default as validate } from './validate.js';\nexport { default as version } from './version.js';\n"
  },
  {
    "path": "src/max.ts",
    "content": "export default 'ffffffff-ffff-ffff-ffff-ffffffffffff';\n"
  },
  {
    "path": "src/md5-browser.ts",
    "content": "/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes: Uint8Array) {\n  const words = uint8ToUint32(bytes);\n\n  const md5Bytes = wordsToMd5(words, bytes.length * 8);\n  return uint32ToUint8(md5Bytes);\n}\n\n/*\n * Convert an array of little-endian words to an array of bytes\n */\nfunction uint32ToUint8(input: Uint32Array) {\n  // Note: On little endian platforms we could simply return `new\n  // Uint8Array(input.buffer)` here, but that that won't work on big-endian\n  // systems.  (That said, there's code below that appears to already assume\n  // little-endian, so maybe this is a moot point?  Either way, keeping the\n  // existing code for now to be safe.)\n  const bytes = new Uint8Array(input.length * 4);\n  for (let i = 0; i < input.length * 4; i++) {\n    bytes[i] = (input[i >> 2] >>> ((i % 4) * 8)) & 0xff;\n  }\n  return bytes;\n}\n\n/**\n * Calculate output length with padding and bit length\n */\nfunction getOutputLength(inputLength8: number) {\n  return (((inputLength8 + 64) >>> 9) << 4) + 14 + 1;\n}\n\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\nfunction wordsToMd5(x: Uint32Array, len: number) {\n  /* append padding */\n  const xpad = new Uint32Array(getOutputLength(len)).fill(0);\n  xpad.set(x);\n  xpad[len >> 5] |= 0x80 << len % 32;\n  xpad[xpad.length - 1] = len;\n  x = xpad;\n\n  let a = 1732584193;\n  let b = -271733879;\n  let c = -1732584194;\n  let d = 271733878;\n\n  for (let i = 0; i < x.length; i += 16) {\n    const olda = a;\n    const oldb = b;\n    const oldc = c;\n    const oldd = d;\n\n    a = md5ff(a, b, c, d, x[i], 7, -680876936);\n    d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n    c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n    b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n    a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n    d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n    c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n    b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n    a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n    d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n    c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n    b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n    a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n    d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n    c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n    b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n\n    a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n    d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n    c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n    b = md5gg(b, c, d, a, x[i], 20, -373897302);\n    a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n    d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n    c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n    b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n    a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n    d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n    c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n    b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n    a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n    d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n    c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n    b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n\n    a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n    d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n    c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n    b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n    a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n    d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n    c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n    b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n    a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n    d = md5hh(d, a, b, c, x[i], 11, -358537222);\n    c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n    b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n    a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n    d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n    c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n    b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n\n    a = md5ii(a, b, c, d, x[i], 6, -198630844);\n    d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n    c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n    b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n    a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n    d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n    c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n    b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n    a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n    d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n    c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n    b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n    a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n    d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n    c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n    b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n\n    a = safeAdd(a, olda);\n    b = safeAdd(b, oldb);\n    c = safeAdd(c, oldc);\n    d = safeAdd(d, oldd);\n  }\n\n  return Uint32Array.of(a, b, c, d);\n}\n\n/*\n * Convert Uint8Array to Uint32 array (little-endian)\n */\nfunction uint8ToUint32(input: Uint8Array) {\n  if (input.length === 0) {\n    return new Uint32Array();\n  }\n\n  const output = new Uint32Array(getOutputLength(input.length * 8)).fill(0);\n  for (let i = 0; i < input.length; i++) {\n    output[i >> 2] |= (input[i] & 0xff) << ((i % 4) * 8);\n  }\n  return output;\n}\n\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\nfunction safeAdd(x: number, y: number) {\n  const lsw = (x & 0xffff) + (y & 0xffff);\n  const msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n  return (msw << 16) | (lsw & 0xffff);\n}\n\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\nfunction bitRotateLeft(num: number, cnt: number) {\n  return (num << cnt) | (num >>> (32 - cnt));\n}\n\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\nfunction md5cmn(q: number, a: number, b: number, x: number, s: number, t: number) {\n  return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a: number, b: number, c: number, d: number, x: number, s: number, t: number) {\n  return md5cmn((b & c) | (~b & d), a, b, x, s, t);\n}\n\nfunction md5gg(a: number, b: number, c: number, d: number, x: number, s: number, t: number) {\n  return md5cmn((b & d) | (c & ~d), a, b, x, s, t);\n}\n\nfunction md5hh(a: number, b: number, c: number, d: number, x: number, s: number, t: number) {\n  return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a: number, b: number, c: number, d: number, x: number, s: number, t: number) {\n  return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nexport default md5;\n"
  },
  {
    "path": "src/md5.ts",
    "content": "import { createHash } from 'node:crypto';\n\nfunction md5(bytes: Uint8Array) {\n  if (Array.isArray(bytes)) {\n    bytes = Buffer.from(bytes);\n  } else if (typeof bytes === 'string') {\n    bytes = Buffer.from(bytes, 'utf8');\n  }\n\n  return createHash('md5').update(bytes).digest();\n}\n\nexport default md5;\n"
  },
  {
    "path": "src/native-browser.ts",
    "content": "const randomUUID =\n  typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\n\nexport default { randomUUID };\n"
  },
  {
    "path": "src/native.ts",
    "content": "import { randomUUID } from 'node:crypto';\n\nexport default { randomUUID };\n"
  },
  {
    "path": "src/nil.ts",
    "content": "export default '00000000-0000-0000-0000-000000000000';\n"
  },
  {
    "path": "src/parse.ts",
    "content": "import validate from './validate.js';\n\nfunction parse(uuid: string) {\n  if (!validate(uuid)) {\n    throw TypeError('Invalid UUID');\n  }\n\n  let v;\n  return Uint8Array.of(\n    (v = parseInt(uuid.slice(0, 8), 16)) >>> 24,\n    (v >>> 16) & 0xff,\n    (v >>> 8) & 0xff,\n    v & 0xff,\n\n    // Parse ........-####-....-....-............\n    (v = parseInt(uuid.slice(9, 13), 16)) >>> 8,\n    v & 0xff,\n\n    // Parse ........-....-####-....-............\n    (v = parseInt(uuid.slice(14, 18), 16)) >>> 8,\n    v & 0xff,\n\n    // Parse ........-....-....-####-............\n    (v = parseInt(uuid.slice(19, 23), 16)) >>> 8,\n    v & 0xff,\n\n    // Parse ........-....-....-....-############\n    // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n    ((v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000) & 0xff,\n    (v / 0x100000000) & 0xff,\n    (v >>> 24) & 0xff,\n    (v >>> 16) & 0xff,\n    (v >>> 8) & 0xff,\n    v & 0xff\n  );\n}\n\nexport default parse;\n"
  },
  {
    "path": "src/regex.ts",
    "content": "export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;\n"
  },
  {
    "path": "src/rng-browser.ts",
    "content": "// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\n\nlet getRandomValues: typeof crypto.getRandomValues | undefined;\n\nconst rnds8 = new Uint8Array(16);\n\nexport default function rng() {\n  // lazy load so that environments that need to polyfill have a chance to do so\n  if (!getRandomValues) {\n    if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n      throw new Error(\n        'crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'\n      );\n    }\n\n    getRandomValues = crypto.getRandomValues.bind(crypto);\n  }\n\n  return getRandomValues(rnds8);\n}\n"
  },
  {
    "path": "src/rng.ts",
    "content": "import { randomFillSync } from 'node:crypto';\n\nconst rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate\nlet poolPtr = rnds8Pool.length;\n\nexport default function rng() {\n  if (poolPtr > rnds8Pool.length - 16) {\n    randomFillSync(rnds8Pool);\n    poolPtr = 0;\n  }\n  return rnds8Pool.slice(poolPtr, (poolPtr += 16));\n}\n"
  },
  {
    "path": "src/sha1-browser.ts",
    "content": "// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s: 0 | 1 | 2 | 3, x: number, y: number, z: number) {\n  switch (s) {\n    case 0:\n      return (x & y) ^ (~x & z);\n    case 1:\n      return x ^ y ^ z;\n    case 2:\n      return (x & y) ^ (x & z) ^ (y & z);\n    case 3:\n      return x ^ y ^ z;\n  }\n}\n\nfunction ROTL(x: number, n: number) {\n  return (x << n) | (x >>> (32 - n));\n}\n\nfunction sha1(bytes: Uint8Array): Uint8Array {\n  const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n  const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n  const newBytes = new Uint8Array(bytes.length + 1);\n  newBytes.set(bytes);\n  newBytes[bytes.length] = 0x80;\n  bytes = newBytes;\n\n  const l = bytes.length / 4 + 2;\n  const N = Math.ceil(l / 16);\n  const M: Uint32Array[] = new Array(N);\n\n  for (let i = 0; i < N; ++i) {\n    const arr = new Uint32Array(16);\n\n    for (let j = 0; j < 16; ++j) {\n      arr[j] =\n        (bytes[i * 64 + j * 4] << 24) |\n        (bytes[i * 64 + j * 4 + 1] << 16) |\n        (bytes[i * 64 + j * 4 + 2] << 8) |\n        bytes[i * 64 + j * 4 + 3];\n    }\n\n    M[i] = arr;\n  }\n\n  M[N - 1][14] = ((bytes.length - 1) * 8) / Math.pow(2, 32);\n  M[N - 1][14] = Math.floor(M[N - 1][14]);\n  M[N - 1][15] = ((bytes.length - 1) * 8) & 0xffffffff;\n\n  for (let i = 0; i < N; ++i) {\n    const W = new Uint32Array(80);\n\n    for (let t = 0; t < 16; ++t) {\n      W[t] = M[i][t];\n    }\n\n    for (let t = 16; t < 80; ++t) {\n      W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n    }\n\n    let a = H[0];\n    let b = H[1];\n    let c = H[2];\n    let d = H[3];\n    let e = H[4];\n\n    for (let t = 0; t < 80; ++t) {\n      const s = Math.floor(t / 20) as 0 | 1 | 2 | 3;\n      const T = (ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t]) >>> 0;\n      e = d;\n      d = c;\n      c = ROTL(b, 30) >>> 0;\n      b = a;\n      a = T;\n    }\n\n    H[0] = (H[0] + a) >>> 0;\n    H[1] = (H[1] + b) >>> 0;\n    H[2] = (H[2] + c) >>> 0;\n    H[3] = (H[3] + d) >>> 0;\n    H[4] = (H[4] + e) >>> 0;\n  }\n\n  // Note: Uint8Array.of() does `& 0xff` for each value\n  return Uint8Array.of(\n    H[0] >> 24,\n    H[0] >> 16,\n    H[0] >> 8,\n    H[0],\n    H[1] >> 24,\n    H[1] >> 16,\n    H[1] >> 8,\n    H[1],\n    H[2] >> 24,\n    H[2] >> 16,\n    H[2] >> 8,\n    H[2],\n    H[3] >> 24,\n    H[3] >> 16,\n    H[3] >> 8,\n    H[3],\n    H[4] >> 24,\n    H[4] >> 16,\n    H[4] >> 8,\n    H[4]\n  );\n}\n\nexport default sha1;\n"
  },
  {
    "path": "src/sha1.ts",
    "content": "import { createHash } from 'node:crypto';\n\nfunction sha1(bytes: Uint8Array) {\n  if (Array.isArray(bytes)) {\n    bytes = Buffer.from(bytes);\n  } else if (typeof bytes === 'string') {\n    bytes = Buffer.from(bytes, 'utf8');\n  }\n\n  return createHash('sha1').update(bytes).digest();\n}\n\nexport default sha1;\n"
  },
  {
    "path": "src/stringify.ts",
    "content": "import validate from './validate.js';\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nconst byteToHex: string[] = [];\n\nfor (let i = 0; i < 256; ++i) {\n  byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr: Uint8Array, offset = 0): string {\n  // Note: Be careful editing this code!  It's been tuned for performance\n  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n  //\n  // Note to future-self: No, you can't remove the `toLowerCase()` call.\n  // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351\n  return (\n    byteToHex[arr[offset + 0]] +\n    byteToHex[arr[offset + 1]] +\n    byteToHex[arr[offset + 2]] +\n    byteToHex[arr[offset + 3]] +\n    '-' +\n    byteToHex[arr[offset + 4]] +\n    byteToHex[arr[offset + 5]] +\n    '-' +\n    byteToHex[arr[offset + 6]] +\n    byteToHex[arr[offset + 7]] +\n    '-' +\n    byteToHex[arr[offset + 8]] +\n    byteToHex[arr[offset + 9]] +\n    '-' +\n    byteToHex[arr[offset + 10]] +\n    byteToHex[arr[offset + 11]] +\n    byteToHex[arr[offset + 12]] +\n    byteToHex[arr[offset + 13]] +\n    byteToHex[arr[offset + 14]] +\n    byteToHex[arr[offset + 15]]\n  ).toLowerCase();\n}\n\nfunction stringify(arr: Uint8Array, offset = 0) {\n  const uuid = unsafeStringify(arr, offset);\n\n  // Consistency check for valid UUID.  If this throws, it's likely due to one\n  // of the following:\n  // - One or more input array values don't map to a hex octet (leading to\n  // \"undefined\" in the uuid)\n  // - Invalid input values for the RFC `version` or `variant` fields\n  if (!validate(uuid)) {\n    throw TypeError('Stringified UUID is invalid');\n  }\n\n  return uuid;\n}\n\nexport default stringify;\n"
  },
  {
    "path": "src/test/parse.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport parse from '../parse.js';\nimport stringify from '../stringify.js';\nimport uuidv4 from '../v4.js';\n\n// Deterministic PRNG for reproducible tests\n// See https://stackoverflow.com/a/47593316/109538\nfunction splitmix32(a: number) {\n  return function () {\n    a |= 0;\n    a = (a + 0x9e3779b9) | 0;\n    let t = a ^ (a >>> 16);\n    t = Math.imul(t, 0x21f0aaad);\n    t = t ^ (t >>> 15);\n    t = Math.imul(t, 0x735a2d97);\n    return ((t = t ^ (t >>> 15)) >>> 0) / 4294967296;\n  };\n}\nconst rand = splitmix32(0x12345678);\n\nfunction rng(bytes = new Uint8Array(16)) {\n  for (let i = 0; i < 16; i++) {\n    bytes[i] = rand() * 256;\n  }\n\n  return bytes;\n}\n\ndescribe('parse', () => {\n  test('String -> bytes parsing', () => {\n    assert.deepStrictEqual(\n      parse('0f5abcd1-c194-47f3-905b-2df7263a084b'),\n      Uint8Array.from([\n        0x0f, 0x5a, 0xbc, 0xd1, 0xc1, 0x94, 0x47, 0xf3, 0x90, 0x5b, 0x2d, 0xf7, 0x26, 0x3a, 0x08,\n        0x4b,\n      ])\n    );\n  });\n\n  test('String -> bytes -> string symmetry for assorted uuids', () => {\n    for (let i = 0; i < 1000; i++) {\n      const uuid = uuidv4({ rng });\n      assert.equal(stringify(parse(uuid)), uuid);\n    }\n  });\n\n  test('Case neutrality', () => {\n    // Verify upper/lower case neutrality\n    assert.deepStrictEqual(\n      parse('0f5abcd1-c194-47f3-905b-2df7263a084b'),\n      parse('0f5abcd1-c194-47f3-905b-2df7263a084b'.toUpperCase())\n    );\n  });\n\n  test('Null UUID case', () => {\n    assert.deepStrictEqual(\n      parse('00000000-0000-0000-0000-000000000000'),\n      Uint8Array.from(new Array(16).fill(0))\n    );\n  });\n\n  test('UUID validation', () => {\n    // @ts-expect-error testing invalid input\n    assert.throws(() => parse());\n\n    assert.throws(() => parse('invalid uuid'));\n    assert.throws(() => parse('zyxwvuts-rqpo-nmlk-jihg-fedcba000000'));\n  });\n});\n"
  },
  {
    "path": "src/test/rng.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport rng from '../rng.js';\n\ndescribe('rng', () => {\n  test('Node.js RNG', () => {\n    const bytes = rng();\n    assert.equal(bytes.length, 16);\n\n    for (let i = 0; i < bytes.length; ++i) {\n      assert.equal(typeof bytes[i], 'number');\n    }\n  });\n\n  // Test of whatwgRNG missing for now since with esmodules we can no longer manipulate the\n  // require.cache.\n});\n"
  },
  {
    "path": "src/test/stringify.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport stringify, { unsafeStringify } from '../stringify.js';\n\nconst BYTES = Uint8Array.of(\n  0x0f,\n  0x5a,\n  0xbc,\n  0xd1,\n  0xc1,\n  0x94,\n  0x47,\n  0xf3,\n  0x90,\n  0x5b,\n  0x2d,\n  0xf7,\n  0x26,\n  0x3a,\n  0x08,\n  0x4b\n);\n\ndescribe('stringify', () => {\n  test('Stringify Array (unsafe)', () => {\n    assert.equal(unsafeStringify(BYTES), '0f5abcd1-c194-47f3-905b-2df7263a084b');\n  });\n\n  test('Stringify w/ offset (unsafe)', () => {\n    const bytes = new Uint8Array(19).fill(0);\n    bytes.set(BYTES, 3);\n    assert.equal(unsafeStringify(bytes, 3), '0f5abcd1-c194-47f3-905b-2df7263a084b');\n  });\n\n  test('Stringify Array (safe)', () => {\n    assert.equal(stringify(BYTES), '0f5abcd1-c194-47f3-905b-2df7263a084b');\n  });\n\n  test('Throws on not enough values (safe)', () => {\n    const bytes = BYTES.slice(0, 15);\n    assert.throws(() => stringify(bytes));\n  });\n});\n"
  },
  {
    "path": "src/test/test_constants.ts",
    "content": "import MAX from '../max.js';\nimport NIL from '../nil.js';\n\n// Table of [uuid value, expected validate(), [expected version()]]\nexport const TESTS = [\n  // constants\n  { value: NIL, expectedValidate: true, expectedVersion: 0 },\n  { value: MAX, expectedValidate: true, expectedVersion: 15 },\n\n  // each version, with either all 0's or all 1's in settable bits\n  { value: '00000000-0000-1000-8000-000000000000', expectedValidate: true, expectedVersion: 1 },\n  { value: 'ffffffff-ffff-1fff-8fff-ffffffffffff', expectedValidate: true, expectedVersion: 1 },\n  { value: '00000000-0000-2000-8000-000000000000', expectedValidate: true, expectedVersion: 2 },\n  { value: 'ffffffff-ffff-2fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 2 },\n  { value: '00000000-0000-3000-8000-000000000000', expectedValidate: true, expectedVersion: 3 },\n  { value: 'ffffffff-ffff-3fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 3 },\n  { value: '00000000-0000-4000-8000-000000000000', expectedValidate: true, expectedVersion: 4 },\n  { value: 'ffffffff-ffff-4fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 4 },\n  { value: '00000000-0000-5000-8000-000000000000', expectedValidate: true, expectedVersion: 5 },\n  { value: 'ffffffff-ffff-5fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 5 },\n  { value: '00000000-0000-6000-8000-000000000000', expectedValidate: true, expectedVersion: 6 },\n  { value: 'ffffffff-ffff-6fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 6 },\n  { value: '00000000-0000-7000-8000-000000000000', expectedValidate: true, expectedVersion: 7 },\n  { value: 'ffffffff-ffff-7fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 7 },\n  { value: '00000000-0000-8000-8000-000000000000', expectedValidate: true, expectedVersion: 8 },\n  { value: 'ffffffff-ffff-8fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 8 },\n  { value: '00000000-0000-9000-8000-000000000000', expectedValidate: false },\n  { value: 'ffffffff-ffff-9fff-bfff-ffffffffffff', expectedValidate: false },\n  { value: '00000000-0000-a000-8000-000000000000', expectedValidate: false },\n  { value: 'ffffffff-ffff-afff-bfff-ffffffffffff', expectedValidate: false },\n  { value: '00000000-0000-b000-8000-000000000000', expectedValidate: false },\n  { value: 'ffffffff-ffff-bfff-bfff-ffffffffffff', expectedValidate: false },\n  { value: '00000000-0000-c000-8000-000000000000', expectedValidate: false },\n  { value: 'ffffffff-ffff-cfff-bfff-ffffffffffff', expectedValidate: false },\n  { value: '00000000-0000-d000-8000-000000000000', expectedValidate: false },\n  { value: 'ffffffff-ffff-dfff-bfff-ffffffffffff', expectedValidate: false },\n  { value: '00000000-0000-e000-8000-000000000000', expectedValidate: false },\n  { value: 'ffffffff-ffff-efff-bfff-ffffffffffff', expectedValidate: false },\n\n  // selection of normal, valid UUIDs\n  { value: 'd9428888-122b-11e1-b85c-61cd3cbb3210', expectedValidate: true, expectedVersion: 1 },\n  { value: '000003e8-2363-21ef-b200-325096b39f47', expectedValidate: true, expectedVersion: 2 },\n  { value: 'a981a0c2-68b1-35dc-bcfc-296e52ab01ec', expectedValidate: true, expectedVersion: 3 },\n  { value: '109156be-c4fb-41ea-b1b4-efe1671c5836', expectedValidate: true, expectedVersion: 4 },\n  { value: '90123e1c-7512-523e-bb28-76fab9f2f73d', expectedValidate: true, expectedVersion: 5 },\n  { value: '1ef21d2f-1207-6660-8c4f-419efbd44d48', expectedValidate: true, expectedVersion: 6 },\n  { value: '017f22e2-79b0-7cc3-98c4-dc0c0c07398f', expectedValidate: true, expectedVersion: 7 },\n  { value: '0d8f23a0-697f-83ae-802e-48f3756dd581', expectedValidate: true, expectedVersion: 8 },\n\n  // all variant octet values\n  { value: '00000000-0000-1000-0000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-1000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-2000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-3000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-4000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-5000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-6000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-7000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-8000-000000000000', expectedValidate: true, expectedVersion: 1 },\n  { value: '00000000-0000-1000-9000-000000000000', expectedValidate: true, expectedVersion: 1 },\n  { value: '00000000-0000-1000-a000-000000000000', expectedValidate: true, expectedVersion: 1 },\n  { value: '00000000-0000-1000-b000-000000000000', expectedValidate: true, expectedVersion: 1 },\n  { value: '00000000-0000-1000-c000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-d000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-e000-000000000000', expectedValidate: false },\n  { value: '00000000-0000-1000-f000-000000000000', expectedValidate: false },\n\n  // invalid strings\n  { value: '00000000000000000000000000000000', expectedValidate: false }, // unhyphenated NIL\n  { value: '', expectedValidate: false },\n  { value: 'invalid uuid string', expectedValidate: false },\n  {\n    value: '=Y00a-f*vb*-c-d#-p00f\\b-g0h-#i^-j*3&-L00k-\\nl---00n-fg000-00p-00r+',\n    expectedValidate: false,\n  },\n\n  // invalid types\n  { value: undefined, expectedValidate: false },\n  { value: null, expectedValidate: false },\n  { value: 123, expectedValidate: false },\n  { value: /regex/, expectedValidate: false },\n  { value: new Date(0), expectedValidate: false },\n  { value: false, expectedValidate: false },\n];\n\n// Add NIL and MAX UUIDs with 1-bit flipped in each position\nfor (let charIndex = 0; charIndex < 36; charIndex++) {\n  // Skip hyphens and version char\n  if (\n    charIndex === 8 ||\n    charIndex === 13 ||\n    charIndex === 14 || // version char\n    charIndex === 18 ||\n    charIndex === 23\n  ) {\n    continue;\n  }\n\n  const nilChars = NIL.split('');\n  const maxChars = MAX.split('');\n\n  for (let i = 0; i < 4; i++) {\n    nilChars[charIndex] = (0x0 ^ (1 << i)).toString(16);\n    // NIL UUIDs w/ a single 1-bit\n    TESTS.push({ value: nilChars.join(''), expectedValidate: false });\n\n    // MAX UUIDs w/ a single 0-bit\n    maxChars[charIndex] = (0xf ^ (1 << i)).toString(16);\n    TESTS.push({ value: maxChars.join(''), expectedValidate: false });\n  }\n}\n"
  },
  {
    "path": "src/test/v1.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport parse from '../parse.js';\nimport v1, { updateV1State } from '../v1.js';\n\n// Verify ordering of v1 ids created with explicit times\nconst TIME = 1321644961388; // 2011-11-18 11:36:01.388-08:00\n\n// Fixture values for testing with the rfc v1 UUID example:\n// https://www.rfc-editor.org/rfc/rfc9562.html#name-example-of-a-uuidv1-value\nconst RFC_V1 = 'c232ab00-9414-11ec-b3c8-9f68deced846';\nconst RFC_V1_BYTES = parse(RFC_V1);\n\n// `options` for producing the above RFC UUID\nconst RFC_OPTIONS = {\n  msecs: 0x17f22e279b0,\n  nsecs: 0,\n  clockseq: 0x33c8,\n  node: Uint8Array.of(0x9f, 0x68, 0xde, 0xce, 0xd8, 0x46),\n};\n\n// random bytes for producing the above RFC UUID\nconst RFC_RANDOM = Uint8Array.of(\n  // unused\n  0,\n  0,\n  0,\n  0,\n  0,\n  0,\n  0,\n  0,\n\n  // clock seq\n  RFC_OPTIONS.clockseq >> 8,\n  RFC_OPTIONS.clockseq & 0xff,\n\n  // node\n  ...RFC_OPTIONS.node\n);\n\n// Compare v1 timestamp fields chronologically\nfunction compareV1TimeField(a: string, b: string) {\n  a = a.split('-').slice(0, 3).reverse().join('');\n  b = b.split('-').slice(0, 3).reverse().join('');\n  return a < b ? -1 : a > b ? 1 : 0;\n}\n\ndescribe('v1', () => {\n  test('v1 sort order (default)', () => {\n    const ids = [v1(), v1(), v1(), v1(), v1()];\n\n    const sorted = [...ids].sort(compareV1TimeField);\n    assert.deepEqual(ids, sorted);\n  });\n\n  // Verify ordering of v1 ids created with explicit times\n  test('v1 sort order (time option)', () => {\n    const ids = [\n      v1({ msecs: TIME - 10 * 3600 * 1000 }),\n      v1({ msecs: TIME - 1 }),\n      v1({ msecs: TIME }),\n      v1({ msecs: TIME + 1 }),\n      v1({ msecs: TIME + 28 * 24 * 3600 * 1000 }),\n    ];\n\n    const sorted = [...ids].sort(compareV1TimeField);\n    assert.deepEqual(ids, sorted);\n  });\n\n  test('v1(options)', () => {\n    assert.equal(v1({ msecs: RFC_OPTIONS.msecs, random: RFC_RANDOM }), RFC_V1, 'minimal options');\n    assert.equal(v1(RFC_OPTIONS), RFC_V1, 'full options');\n  });\n\n  test('v1(options) equality', () => {\n    assert.notEqual(v1({ msecs: TIME }), v1({ msecs: TIME }), 'UUIDs with minimal options differ');\n    assert.equal(v1(RFC_OPTIONS), v1(RFC_OPTIONS), 'UUIDs with full options are identical');\n  });\n\n  test('fills one UUID into a buffer as expected', () => {\n    const buffer = new Uint8Array(16);\n    const result = v1(RFC_OPTIONS, buffer);\n    assert.deepEqual(buffer, RFC_V1_BYTES);\n    assert.strictEqual(buffer, result);\n  });\n\n  test('fills two UUIDs into a buffer as expected', () => {\n    const buffer = new Uint8Array(32);\n    v1(RFC_OPTIONS, buffer, 0);\n    v1(RFC_OPTIONS, buffer, 16);\n\n    const expectedBuf = new Uint8Array(32);\n    expectedBuf.set(RFC_V1_BYTES);\n    expectedBuf.set(RFC_V1_BYTES, 16);\n\n    assert.deepEqual(buffer, expectedBuf);\n  });\n\n  test('v1() state transitions', () => {\n    // Test fixture for internal state passed into updateV1State function\n    const PRE_STATE = {\n      msecs: 10,\n      nsecs: 20,\n      clockseq: 0x1234,\n      node: Uint8Array.of(0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc),\n    };\n\n    // Note: The test code, below, passes RFC_RANDOM as the `rnds` argument for\n    // convenience.  This allows us to test that fields have been initialized from\n    // the rnds argument by testing for RFC_OPTIONS values in the output state.\n\n    const tests = [\n      {\n        title: 'initial state',\n        state: {},\n        now: 10,\n        expected: {\n          msecs: 10, // -> now\n          nsecs: 0, // -> init\n          clockseq: RFC_OPTIONS.clockseq, // -> random\n          node: RFC_OPTIONS.node, // -> random\n        },\n      },\n      {\n        title: 'same time interval',\n        state: { ...PRE_STATE },\n        now: PRE_STATE.msecs,\n        expected: {\n          ...PRE_STATE,\n          nsecs: 21, // -> +1\n        },\n      },\n      {\n        title: 'new time interval',\n        state: { ...PRE_STATE },\n        now: PRE_STATE.msecs + 1,\n        expected: {\n          ...PRE_STATE,\n          msecs: PRE_STATE.msecs + 1, // -> +1\n          nsecs: 0, // -> init\n        },\n      },\n      {\n        title: 'same time interval (nsecs overflow)',\n        state: { ...PRE_STATE, nsecs: 9999 },\n        now: PRE_STATE.msecs,\n        expected: {\n          ...PRE_STATE,\n          nsecs: 0, // -> init\n          clockseq: RFC_OPTIONS.clockseq, // -> init\n          node: RFC_OPTIONS.node, // -> init\n        },\n      },\n      {\n        title: 'time regression',\n        state: { ...PRE_STATE },\n        now: PRE_STATE.msecs - 1,\n        expected: {\n          ...PRE_STATE,\n          msecs: PRE_STATE.msecs - 1, // -> now\n          clockseq: RFC_OPTIONS.clockseq, // -> init\n          node: RFC_OPTIONS.node, // -> init\n        },\n      },\n    ];\n    for (const { title, state, now, expected } of tests) {\n      assert.deepStrictEqual(updateV1State(state, now, RFC_RANDOM), expected, `Failed: ${title}`);\n    }\n  });\n\n  test('throws when option.random is too short', () => {\n    const random = Uint8Array.of(16);\n    const buffer = new Uint8Array(16).fill(0);\n    assert.throws(() => {\n      v1({ random }, buffer);\n    });\n  });\n\n  test('throws when options.rng() is too short', () => {\n    const buffer = new Uint8Array(16);\n    const rng = () => Uint8Array.of(0); // length = 1\n    assert.throws(() => {\n      v1({ rng }, buffer);\n    });\n  });\n\n  test('throws RangeError for out-of-range indexes', () => {\n    const buf15 = new Uint8Array(15);\n    const buf30 = new Uint8Array(30);\n    assert.throws(() => v1({}, buf15));\n    assert.throws(() => v1({}, buf30, -1));\n    assert.throws(() => v1({}, buf30, 15));\n  });\n});\n"
  },
  {
    "path": "src/test/v35.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport md5 from '../md5.js';\nimport sha1 from '../sha1.js';\nimport v3 from '../v3.js';\nimport { stringToBytes } from '../v35.js';\nimport v5 from '../v5.js';\n\ndescribe('v35', () => {\n  const HASH_SAMPLES = [\n    {\n      input: stringToBytes(''),\n      sha1: 'da39a3ee5e6b4b0d3255bfef95601890afd80709',\n      md5: 'd41d8cd98f00b204e9800998ecf8427e',\n    },\n\n    // Extended ascii chars\n    {\n      input: stringToBytes(\n        '\\t\\b\\f  !\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\u00A1\\u00A2\\u00A3\\u00A4\\u00A5\\u00A6\\u00A7\\u00A8\\u00A9\\u00AA\\u00AB\\u00AC\\u00AE\\u00AF\\u00B0\\u00B1\\u00B2\\u00B3\\u00B4\\u00B5\\u00B6\\u00B7\\u00B8\\u00B9\\u00BA\\u00BB\\u00BC\\u00BD\\u00BE\\u00BF\\u00C0\\u00C1\\u00C2\\u00C3\\u00C4\\u00C5\\u00C6\\u00C7\\u00C8\\u00C9\\u00CA\\u00CB\\u00CC\\u00CD\\u00CE\\u00CF\\u00D0\\u00D1\\u00D2\\u00D3\\u00D4\\u00D5\\u00D6\\u00D7\\u00D8\\u00D9\\u00DA\\u00DB\\u00DC\\u00DD\\u00DE\\u00DF\\u00E0\\u00E1\\u00E2\\u00E3\\u00E4\\u00E5\\u00E6\\u00E7\\u00E8\\u00E9\\u00EA\\u00EB\\u00EC\\u00ED\\u00EE\\u00EF\\u00F0\\u00F1\\u00F2\\u00F3\\u00F4\\u00F5\\u00F6\\u00F7\\u00F8\\u00F9\\u00FA\\u00FB\\u00FC\\u00FD\\u00FE\\u00FF'\n      ),\n      sha1: 'ca4a426a3d536f14cfd79011e79e10d64de950a0',\n      md5: 'e8098ec21950f841731d28749129d3ee',\n    },\n\n    // A sampling from the Unicode BMP\n    {\n      input: stringToBytes(\n        '\\u00A5\\u0104\\u018F\\u0256\\u02B1o\\u0315\\u038E\\u0409\\u0500\\u0531\\u05E1\\u05B6\\u0920\\u0903\\u09A4\\u0983\\u0A20\\u0A02\\u0AA0\\u0A83\\u0B06\\u0C05\\u0C03\\u1401\\u16A0'\n      ),\n      sha1: 'f2753ebc390e5f637e333c2a4179644a93ae9f65',\n      md5: '231b309e277b6be8bb3d6c688b7f098b',\n    },\n  ];\n\n  function hashToHex(hash: Uint8Array) {\n    const chars = new Array(hash.length);\n    for (let i = 0; i < hash.length; i++) {\n      chars[i] = hash[i].toString(16).padStart(2, '0');\n    }\n    return chars.join('');\n  }\n\n  HASH_SAMPLES.forEach(function (sample, i) {\n    test(`sha1(node) HASH_SAMPLES[${i}]`, () => {\n      assert.equal(hashToHex(sha1(sample.input)), sample.sha1);\n    });\n  });\n\n  HASH_SAMPLES.forEach(function (sample, i) {\n    test(`md5(node) HASH_SAMPLES[${i}]`, () => {\n      assert.equal(hashToHex(md5(sample.input)), sample.md5);\n    });\n  });\n\n  test('v3', () => {\n    // Expect to get the same results as http://tools.adjet.org/uuid-v3\n    assert.strictEqual(v3('hello.example.com', v3.DNS), '9125a8dc-52ee-365b-a5aa-81b0b3681cf6');\n\n    assert.strictEqual(\n      v3('http://example.com/hello', v3.URL),\n      'c6235813-3ba4-3801-ae84-e0a6ebb7d138'\n    );\n\n    assert.strictEqual(\n      v3('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'),\n      'a981a0c2-68b1-35dc-bcfc-296e52ab01ec'\n    );\n  });\n\n  test('v3 namespace.toUpperCase', () => {\n    assert.strictEqual(\n      v3('hello.example.com', v3.DNS.toUpperCase()),\n      '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'\n    );\n\n    assert.strictEqual(\n      v3('http://example.com/hello', v3.URL.toUpperCase()),\n      'c6235813-3ba4-3801-ae84-e0a6ebb7d138'\n    );\n\n    assert.strictEqual(\n      v3('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'.toUpperCase()),\n      'a981a0c2-68b1-35dc-bcfc-296e52ab01ec'\n    );\n  });\n\n  test('v3 namespace string validation', () => {\n    assert.throws(() => {\n      v3('hello.example.com', 'zyxwvuts-rqpo-nmlk-jihg-fedcba000000');\n    });\n\n    assert.throws(() => {\n      v3('hello.example.com', 'invalid uuid value');\n    });\n\n    assert.ok(v3('hello.example.com', '00000000-0000-0000-0000-000000000000'));\n  });\n\n  test('v3 namespace buffer validation', () => {\n    assert.throws(() => {\n      v3('hello.example.com', new Uint8Array(15));\n    });\n\n    assert.throws(() => {\n      v3('hello.example.com', new Uint8Array(17));\n    });\n\n    assert.ok(v3('hello.example.com', new Uint8Array(16).fill(0)));\n  });\n\n  test('v3 fill buffer', () => {\n    let buf = new Uint8Array(16);\n\n    const expectedUuid = Uint8Array.of(\n      0x91,\n      0x25,\n      0xa8,\n      0xdc,\n      0x52,\n      0xee,\n      0x36,\n      0x5b,\n      0xa5,\n      0xaa,\n      0x81,\n      0xb0,\n      0xb3,\n      0x68,\n      0x1c,\n      0xf6\n    );\n\n    const result = v3('hello.example.com', v3.DNS, buf);\n\n    assert.deepEqual(buf, expectedUuid);\n    assert.strictEqual(result, buf);\n\n    // test offsets as well\n    buf = new Uint8Array(19).fill(0xaa);\n\n    const expectedBuf = new Uint8Array(19).fill(0xaa);\n    expectedBuf.set(expectedUuid, 3);\n\n    v3('hello.example.com', v3.DNS, buf, 3);\n\n    assert.deepEqual(buf, expectedBuf);\n  });\n\n  test('v3 undefined/null', () => {\n    // @ts-expect-error testing invalid input\n    assert.throws(() => v3());\n    // @ts-expect-error testing invalid input\n    assert.throws(() => v3('hello'));\n    // @ts-expect-error testing invalid input\n    assert.throws(() => v3('hello.example.com', undefined));\n    // @ts-expect-error testing invalid input\n    assert.throws(() => v3('hello.example.com', null, new Uint8Array(16)));\n  });\n\n  test('v5', () => {\n    // Expect to get the same results as http://tools.adjet.org/uuid-v5\n    assert.strictEqual(v5('hello.example.com', v5.DNS), 'fdda765f-fc57-5604-a269-52a7df8164ec');\n\n    assert.strictEqual(\n      v5('http://example.com/hello', v5.URL),\n      '3bbcee75-cecc-5b56-8031-b6641c1ed1f1'\n    );\n\n    assert.strictEqual(\n      v5('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'),\n      '90123e1c-7512-523e-bb28-76fab9f2f73d'\n    );\n  });\n\n  test('v5 namespace.toUpperCase', () => {\n    // Expect to get the same results as http://tools.adjet.org/uuid-v5\n    assert.strictEqual(\n      v5('hello.example.com', v5.DNS.toUpperCase()),\n      'fdda765f-fc57-5604-a269-52a7df8164ec'\n    );\n\n    assert.strictEqual(\n      v5('http://example.com/hello', v5.URL.toUpperCase()),\n      '3bbcee75-cecc-5b56-8031-b6641c1ed1f1'\n    );\n\n    assert.strictEqual(\n      v5('hello', '0f5abcd1-c194-47f3-905b-2df7263a084b'.toUpperCase()),\n      '90123e1c-7512-523e-bb28-76fab9f2f73d'\n    );\n  });\n\n  test('v5 namespace string validation', () => {\n    assert.throws(() => {\n      v5('hello.example.com', 'zyxwvuts-rqpo-nmlk-jihg-fedcba000000');\n    });\n\n    assert.throws(() => {\n      v5('hello.example.com', 'invalid uuid value');\n    });\n\n    assert.ok(v5('hello.example.com', '00000000-0000-0000-0000-000000000000'));\n  });\n\n  test('v5 namespace buffer validation', () => {\n    assert.throws(() => {\n      v5('hello.example.com', new Uint8Array(15));\n    });\n\n    assert.throws(() => {\n      v5('hello.example.com', new Uint8Array(17));\n    });\n\n    assert.ok(v5('hello.example.com', new Uint8Array(16).fill(0)));\n  });\n\n  test('v5 fill buffer', () => {\n    let buf = new Uint8Array(16);\n\n    const expectedUuid = Uint8Array.of(\n      0xfd,\n      0xda,\n      0x76,\n      0x5f,\n      0xfc,\n      0x57,\n      0x56,\n      0x04,\n      0xa2,\n      0x69,\n      0x52,\n      0xa7,\n      0xdf,\n      0x81,\n      0x64,\n      0xec\n    );\n\n    const result = v5('hello.example.com', v5.DNS, buf);\n    assert.deepEqual(buf, expectedUuid);\n    assert.strictEqual(result, buf);\n\n    // test offsets as well\n    buf = new Uint8Array(19).fill(0xaa);\n\n    const expectedBuf = new Uint8Array(19).fill(0xaa);\n    expectedBuf.set(expectedUuid, 3);\n\n    v5('hello.example.com', v5.DNS, buf, 3);\n\n    assert.deepEqual(buf, expectedBuf);\n  });\n\n  test('v5 undefined/null', () => {\n    // @ts-expect-error testing invalid input\n    assert.throws(() => v5());\n    // @ts-expect-error testing invalid input\n    assert.throws(() => v5('hello'));\n    // @ts-expect-error testing invalid input\n    assert.throws(() => v5('hello.example.com', undefined));\n    // @ts-expect-error testing invalid input\n    assert.throws(() => v5('hello.example.com', null, new Uint8Array(16)));\n  });\n\n  test('v3/v5 constants', () => {\n    assert.strictEqual(v3.DNS, '6ba7b810-9dad-11d1-80b4-00c04fd430c8');\n    assert.strictEqual(v3.URL, '6ba7b811-9dad-11d1-80b4-00c04fd430c8');\n    assert.strictEqual(v5.DNS, '6ba7b810-9dad-11d1-80b4-00c04fd430c8');\n    assert.strictEqual(v5.URL, '6ba7b811-9dad-11d1-80b4-00c04fd430c8');\n  });\n});\n"
  },
  {
    "path": "src/test/v4.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport native from '../native.js';\nimport v4 from '../v4.js';\n\nconst randomBytesFixture = Uint8Array.of(\n  0x10,\n  0x91,\n  0x56,\n  0xbe,\n  0xc4,\n  0xfb,\n  0xc1,\n  0xea,\n  0x71,\n  0xb4,\n  0xef,\n  0xe1,\n  0x67,\n  0x1c,\n  0x58,\n  0x36\n);\n\nconst expectedBytes = Uint8Array.of(\n  16,\n  145,\n  86,\n  190,\n  196,\n  251,\n  65,\n  234,\n  177,\n  180,\n  239,\n  225,\n  103,\n  28,\n  88,\n  54\n);\n\ndescribe('v4', () => {\n  test('subsequent UUIDs are different', () => {\n    const id1 = v4();\n    const id2 = v4();\n\n    assert.ok(id1 !== id2);\n  });\n\n  test('should uses native randomUUID() if no option is passed', async () => {\n    // TODO: `mock` is not supported until node@18, so we feature-detect it\n    // here.  Once node@16 drops off our support matrix, we can just\n    // static-import it normally\n    const mock = (await import('node:test')).default.mock;\n    if (!mock) {\n      return;\n    }\n\n    const mockRandomUUID = mock.method(native, 'randomUUID');\n\n    assert.equal(mockRandomUUID.mock.callCount(), 0);\n    v4();\n    assert.equal(mockRandomUUID.mock.callCount(), 1);\n\n    mock.restoreAll();\n  });\n\n  test('should not use native randomUUID() if an option is passed', async () => {\n    // TODO: `mock` is not supported until node@18, so we feature-detect it\n    // here.  Once node@16 drops off our support matrix, we can just\n    // static-import it normally\n    const mock = (await import('node:test')).default.mock;\n    if (!mock) {\n      return;\n    }\n\n    const mockRandomUUID = mock.method(native, 'randomUUID');\n\n    assert.equal(mockRandomUUID.mock.callCount(), 0);\n    v4({});\n    assert.equal(mockRandomUUID.mock.callCount(), 0);\n\n    mock.restoreAll();\n  });\n\n  test('explicit options.random produces expected result', () => {\n    const id = v4({ random: randomBytesFixture });\n    assert.strictEqual(id, '109156be-c4fb-41ea-b1b4-efe1671c5836');\n  });\n\n  test('explicit options.rng produces expected result', () => {\n    const id = v4({ rng: () => randomBytesFixture });\n    assert.strictEqual(id, '109156be-c4fb-41ea-b1b4-efe1671c5836');\n  });\n\n  test('fills one UUID into a buffer as expected', () => {\n    const buffer = new Uint8Array(16);\n    const result = v4({ random: randomBytesFixture }, buffer);\n\n    assert.deepEqual(buffer, expectedBytes);\n    assert.strictEqual(buffer, result);\n  });\n\n  test('fills two UUIDs into a buffer as expected', () => {\n    const buffer = new Uint8Array(32);\n    v4({ random: randomBytesFixture }, buffer, 0);\n    v4({ random: randomBytesFixture }, buffer, 16);\n\n    const expectedBuf = new Uint8Array(32);\n    expectedBuf.set(expectedBytes);\n    expectedBuf.set(expectedBytes, 16);\n\n    assert.deepEqual(buffer, expectedBuf);\n  });\n\n  test('throws when option.random is too short', () => {\n    const random = Uint8Array.of(16);\n    const buffer = new Uint8Array(16).fill(0);\n    assert.throws(() => {\n      v4({ random }, buffer);\n    });\n  });\n\n  test('throws when options.rng() is too short', () => {\n    const buffer = new Uint8Array(16);\n    const rng = () => Uint8Array.of(0); // length = 1\n    assert.throws(() => {\n      v4({ rng }, buffer);\n    });\n  });\n\n  test('throws RangeError for out-of-range indexes', () => {\n    const buf15 = new Uint8Array(15);\n    const buf30 = new Uint8Array(30);\n    assert.throws(() => v4({}, buf15));\n    assert.throws(() => v4({}, buf30, -1));\n    assert.throws(() => v4({}, buf30, 15));\n  });\n});\n"
  },
  {
    "path": "src/test/v6.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport v1ToV6 from '../v1ToV6.js';\nimport v6 from '../v6.js';\nimport v6ToV1 from '../v6ToV1.js';\n\ndescribe('v6', () => {\n  const V1_ID = 'f1207660-21d2-11ef-8c4f-419efbd44d48';\n  const V6_ID = '1ef21d2f-1207-6660-8c4f-419efbd44d48';\n\n  const fullOptions = {\n    msecs: 0x133b891f705,\n    nsecs: 0x1538,\n    clockseq: 0x385c,\n    node: Uint8Array.of(0x61, 0xcd, 0x3c, 0xbb, 0x32, 0x10),\n  };\n\n  const EXPECTED_BYTES = Uint8Array.of(\n    0x1e,\n    0x11,\n    0x22,\n    0xbd,\n    0x94,\n    0x28,\n    0x68,\n    0x88,\n    0xb8,\n    0x5c,\n    0x61,\n    0xcd,\n    0x3c,\n    0xbb,\n    0x32,\n    0x10\n  );\n\n  test('default behavior', () => {\n    // Verify explicit options produce expected id\n    const id = v6();\n    assert.ok(\n      /[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/.test(id),\n\n      'id is valid v6 UUID'\n    );\n  });\n\n  test('default behavior (binary type)', () => {\n    const buffer = new Uint8Array(16);\n    const result = v6(fullOptions, buffer);\n    assert.deepEqual(buffer, EXPECTED_BYTES);\n    assert.strictEqual(buffer, result);\n  });\n\n  test('all options', () => {\n    // Verify explicit options produce expected id\n    const id = v6(fullOptions);\n    assert.equal(id, '1e1122bd-9428-6888-b85c-61cd3cbb3210');\n  });\n\n  test('sort by creation time', () => {\n    // Verify ids sort by creation time\n    const ids = [];\n    for (let i = 0; i < 5; i++) {\n      ids.push(v6({ msecs: i * 1000 }));\n    }\n    assert.deepEqual(ids, ids.slice().sort());\n  });\n\n  test('creating at array offset', () => {\n    const buffer = new Uint8Array(32);\n    v6(fullOptions, buffer, 0);\n    v6(fullOptions, buffer, 16);\n\n    const expectedBuf = new Uint8Array(32);\n    expectedBuf.set(EXPECTED_BYTES, 0);\n    expectedBuf.set(EXPECTED_BYTES, 16);\n\n    assert.deepEqual(buffer, expectedBuf);\n  });\n\n  test('v1 -> v6 conversion', () => {\n    const id = v1ToV6(V1_ID);\n    assert.equal(id, V6_ID);\n  });\n\n  test('v6 -> v1 conversion', () => {\n    const id = v6ToV1(V6_ID);\n    assert.equal(id, V1_ID);\n  });\n});\n"
  },
  {
    "path": "src/test/v7.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport parse from '../parse.js';\nimport stringify from '../stringify.js';\nimport { Version7Options } from '../types.js';\nimport v7, { updateV7State } from '../v7.js';\n\n// Fixture values for testing with the rfc v7 UUID example:\n// https://www.rfc-editor.org/rfc/rfc9562.html#name-example-of-a-uuidv7-value\nconst RFC_V7 = '017f22e2-79b0-7cc3-98c4-dc0c0c07398f';\nconst RFC_V7_BYTES = parse('017f22e2-79b0-7cc3-98c4-dc0c0c07398f');\nconst RFC_MSECS = 0x17f22e279b0;\n\n// `option.seq` for the above RFC uuid\nconst RFC_SEQ = (0x0cc3 << 20) | (0x98c4dc >> 2);\n\n// `option,random` for the above RFC uuid\nconst RFC_RANDOM = Uint8Array.of(\n  0x10,\n  0x91,\n  0x56,\n  0xbe,\n  0xc4,\n  0xfb,\n  0x0c,\n  0xc3,\n  0x18,\n  0xc4,\n  0x6c,\n  0x0c,\n  0x0c,\n  0x07,\n  0x39,\n  0x8f\n);\n\ndescribe('v7', () => {\n  test('subsequent UUIDs are different', () => {\n    const id1 = v7();\n    const id2 = v7();\n    assert.ok(id1 !== id2);\n  });\n\n  test('explicit options.random and options.msecs produces expected result', () => {\n    const id = v7({\n      random: RFC_RANDOM,\n      msecs: RFC_MSECS,\n      seq: RFC_SEQ,\n    });\n    assert.strictEqual(id, RFC_V7);\n  });\n\n  test('explicit options.rng produces expected result', () => {\n    const id = v7({\n      rng: () => RFC_RANDOM,\n      msecs: RFC_MSECS,\n      seq: RFC_SEQ,\n    });\n    assert.strictEqual(id, RFC_V7);\n  });\n\n  test('explicit options.msecs produces expected result', () => {\n    const id = v7({\n      msecs: RFC_MSECS,\n    });\n    assert.strictEqual(id.indexOf('017f22e2'), 0);\n  });\n\n  test('fills one UUID into a buffer as expected', () => {\n    const buffer = new Uint8Array(16);\n    const result = v7(\n      {\n        random: RFC_RANDOM,\n        msecs: RFC_MSECS,\n        seq: RFC_SEQ,\n      },\n      buffer\n    );\n    stringify(buffer);\n\n    assert.deepEqual(buffer, RFC_V7_BYTES);\n    assert.strictEqual(buffer, result);\n  });\n\n  test('fills two UUIDs into a buffer as expected', () => {\n    const buffer = new Uint8Array(32);\n\n    v7(\n      {\n        random: RFC_RANDOM,\n        msecs: RFC_MSECS,\n        seq: RFC_SEQ,\n      },\n      buffer,\n      0\n    );\n    v7(\n      {\n        random: RFC_RANDOM,\n        msecs: RFC_MSECS,\n        seq: RFC_SEQ,\n      },\n      buffer,\n      16\n    );\n    const expected = new Uint8Array(32);\n    expected.set(RFC_V7_BYTES);\n    expected.set(RFC_V7_BYTES, 16);\n    assert.deepEqual(buffer, expected);\n  });\n\n  //\n  // monotonic and lexicographical sorting tests\n  //\n\n  test('lexicographical sorting is preserved', () => {\n    let id;\n    let prior;\n    let msecs = RFC_MSECS;\n    for (let i = 0; i < 20000; ++i) {\n      if (i % 1500 === 0) {\n        // every 1500 runs increment msecs so seq is\n        // reinitialized, simulating passage of time\n        msecs += 1;\n      }\n\n      id = v7({ msecs, seq: i });\n\n      if (prior !== undefined) {\n        assert.ok(prior < id, `${prior} < ${id}`);\n      }\n\n      prior = id;\n    }\n  });\n\n  test('can supply seq', () => {\n    let seq = 0x12345;\n    let uuid = v7({\n      msecs: RFC_MSECS,\n      seq,\n    });\n\n    assert.strictEqual(uuid.substr(0, 25), '017f22e2-79b0-7000-848d-1');\n\n    seq = 0x6fffffff;\n    uuid = v7({\n      msecs: RFC_MSECS,\n      seq,\n    });\n\n    assert.strictEqual(uuid.substring(0, 25), '017f22e2-79b0-76ff-bfff-f');\n  });\n\n  test('internal seq is reset upon timestamp change', () => {\n    v7({\n      msecs: RFC_MSECS,\n      seq: 0x6fffffff,\n    });\n\n    const uuid = v7({\n      msecs: RFC_MSECS + 1,\n    });\n\n    assert.ok(uuid.indexOf('fff') !== 15);\n  });\n\n  test('v7() state transitions', () => {\n    const tests = [\n      {\n        title: 'new time interval',\n        state: { msecs: 1, seq: 123 },\n        now: 2,\n        expected: {\n          msecs: 2, // time interval should update\n          seq: 0x6c318c4, // sequence should be randomized\n        },\n      },\n      {\n        title: 'same time interval',\n        state: { msecs: 1, seq: 123 },\n        now: 1,\n        expected: {\n          msecs: 1, // timestamp unchanged\n          seq: 124, // sequence increments\n        },\n      },\n      {\n        title: 'same time interval (sequence rollover)',\n        state: { msecs: 1, seq: 0xffffffff },\n        now: 1,\n        expected: {\n          msecs: 2, // timestamp increments\n          seq: 0, // sequence rolls over\n        },\n      },\n      {\n        title: 'time regression',\n        state: { msecs: 2, seq: 123 },\n        now: 1,\n        expected: {\n          msecs: 2, // timestamp unchanged\n          seq: 124, // sequence increments\n        },\n      },\n      {\n        title: 'time regression (sequence rollover)',\n        state: { msecs: 2, seq: 0xffffffff },\n        now: 1,\n        expected: {\n          // timestamp increments (crazy, right? The system clock goes backwards\n          // but the UUID timestamp moves forward?  Weird, but it's what's\n          // required to maintain monotonicity... and this is why we have unit\n          // tests!)\n          msecs: 3,\n          seq: 0, // sequence rolls over\n        },\n      },\n    ];\n    for (const { title, state, now, expected } of tests) {\n      assert.deepStrictEqual(updateV7State(state, now, RFC_RANDOM), expected, `Failed: ${title}`);\n    }\n  });\n\n  test('flipping bits changes the result', () => {\n    // convert uint8array to BigInt (BE)\n    const asBigInt = (buf: Uint8Array) => buf.reduce((acc, v) => (acc << 8n) | BigInt(v), 0n);\n\n    // convert the given number of bits (LE) to number\n    const asNumber = (bits: number, data: bigint) => Number(BigInt.asUintN(bits, data));\n\n    // flip the nth bit (BE) in a BigInt\n    const flip = (data: bigint, n: number) => data ^ (1n << BigInt(127 - n));\n\n    // Extract v7 `options` from a (BigInt) UUID\n    const optionsFrom = (data: bigint): Version7Options => {\n      const ms = asNumber(48, data >> 80n);\n      const hi = asNumber(12, data >> 64n);\n      const lo = asNumber(20, data >> 42n);\n      const r = BigInt.asUintN(42, data);\n      return {\n        msecs: ms,\n        seq: (hi << 20) | lo,\n        random: Uint8Array.from([\n          ...Array(10).fill(0),\n          ...Array(6)\n            .fill(0)\n            .map((_, i) => asNumber(8, r >> (BigInt(i) * 8n)))\n            .reverse(),\n        ]),\n      };\n    };\n    const buf = new Uint8Array(16);\n    const data = asBigInt(v7({}, buf));\n    const id = stringify(buf);\n    const reserved = [48, 49, 50, 51, 64, 65];\n    for (let i = 0; i < 128; ++i) {\n      if (reserved.includes(i)) {\n        continue; // skip bits used for version and variant\n      }\n      const flipped = flip(data, i);\n      assert.strictEqual(\n        asBigInt(v7(optionsFrom(flipped), buf)).toString(16),\n        flipped.toString(16),\n        `Unequal uuids at bit ${i}`\n      );\n      assert.notStrictEqual(stringify(buf), id);\n    }\n  });\n\n  test('throws when option.random is too short', () => {\n    const random = Uint8Array.of(16);\n    const buffer = new Uint8Array(16).fill(0);\n    assert.throws(() => {\n      v7({ random }, buffer);\n    });\n  });\n\n  test('throws when options.rng() is too short', () => {\n    const buffer = new Uint8Array(16);\n    const rng = () => Uint8Array.of(0); // length = 1\n    assert.throws(() => {\n      v7({ rng }, buffer);\n    });\n  });\n\n  test('throws RangeError for out-of-range indexes', () => {\n    const buf15 = new Uint8Array(15);\n    const buf30 = new Uint8Array(30);\n    assert.throws(() => v7({}, buf15));\n    assert.throws(() => v7({}, buf30, -1));\n    assert.throws(() => v7({}, buf30, 15));\n  });\n});\n"
  },
  {
    "path": "src/test/validate.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport validate from '../validate.js';\nimport { TESTS } from './test_constants.js';\n\ndescribe('validate()', () => {\n  test('TESTS cases', () => {\n    for (const { value, expectedValidate } of TESTS) {\n      assert.strictEqual(\n        validate(value),\n        expectedValidate,\n        `validate(${value}) should be ${expectedValidate}`\n      );\n    }\n  });\n});\n"
  },
  {
    "path": "src/test/version.test.ts",
    "content": "import * as assert from 'node:assert/strict';\nimport { describe, test } from 'node:test';\nimport version from '../version.js';\nimport { TESTS } from './test_constants.js';\n\ndescribe('version()', () => {\n  test('TESTS cases', () => {\n    for (const { value, expectedValidate, expectedVersion } of TESTS) {\n      try {\n        // @ts-expect-error testing invalid input\n        const actualVersion = version(value);\n\n        assert.ok(expectedValidate, `version(${value}) should throw`);\n        assert.strictEqual(actualVersion, expectedVersion);\n      } catch {\n        assert.ok(!expectedValidate, `version(${value}) threw unexpectedly`);\n      }\n    }\n  });\n});\n"
  },
  {
    "path": "src/types.ts",
    "content": "export type UUIDTypes<TBuf extends Uint8Array = Uint8Array> = string | TBuf;\n\nexport type Version1Options = {\n  node?: Uint8Array;\n  clockseq?: number;\n  random?: Uint8Array;\n  rng?: () => Uint8Array;\n  msecs?: number;\n  nsecs?: number;\n  _v6?: boolean; // Internal use only!\n};\n\nexport type Version4Options = {\n  random?: Uint8Array;\n  rng?: () => Uint8Array;\n};\n\nexport type Version6Options = Version1Options;\n\nexport type Version7Options = {\n  random?: Uint8Array;\n  msecs?: number;\n  seq?: number;\n  rng?: () => Uint8Array;\n};\n"
  },
  {
    "path": "src/uuid-bin.ts",
    "content": "import * as assert from 'node:assert/strict';\n\nimport v1 from './v1.js';\nimport v3 from './v3.js';\nimport v4 from './v4.js';\nimport v5 from './v5.js';\nimport v6 from './v6.js';\nimport v7 from './v7.js';\n\nfunction usage() {\n  console.log('Usage:');\n  console.log('  uuid');\n  console.log('  uuid v1');\n  console.log('  uuid v3 <name> <namespace uuid>');\n  console.log('  uuid v4');\n  console.log('  uuid v5 <name> <namespace uuid>');\n  console.log('  uuid v6');\n  console.log('  uuid v7');\n  console.log('  uuid --help');\n  console.log(\n    '\\nNote: <namespace uuid> may be \"URL\" or \"DNS\" to use the corresponding UUIDs defined by RFC9562'\n  );\n}\n\nconst args = process.argv.slice(2);\n\nif (args.indexOf('--help') >= 0) {\n  usage();\n  process.exit(0);\n}\n\nconst version = args.shift() || 'v4';\n\nswitch (version) {\n  case 'v1':\n    console.log(v1());\n    break;\n\n  case 'v3': {\n    const name = args.shift();\n    let namespace = args.shift();\n\n    assert.ok(name != null, 'v3 name not specified');\n    assert.ok(namespace != null, 'v3 namespace not specified');\n\n    if (namespace === 'URL') {\n      namespace = v3.URL;\n    }\n\n    if (namespace === 'DNS') {\n      namespace = v3.DNS;\n    }\n\n    console.log(v3(name, namespace));\n    break;\n  }\n\n  case 'v4':\n    console.log(v4());\n    break;\n\n  case 'v5': {\n    const name = args.shift();\n    let namespace = args.shift();\n\n    assert.ok(name != null, 'v5 name not specified');\n    assert.ok(namespace != null, 'v5 namespace not specified');\n\n    if (namespace === 'URL') {\n      namespace = v5.URL;\n    }\n\n    if (namespace === 'DNS') {\n      namespace = v5.DNS;\n    }\n\n    console.log(v5(name, namespace));\n    break;\n  }\n\n  case 'v6':\n    console.log(v6());\n    break;\n\n  case 'v7':\n    console.log(v7());\n    break;\n\n  default:\n    usage();\n    process.exit(1);\n}\n"
  },
  {
    "path": "src/v1.ts",
    "content": "import rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nimport { UUIDTypes, Version1Options } from './types.js';\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\ntype V1State = {\n  node?: Uint8Array; // node id (47-bit random)\n  clockseq?: number; // sequence number (14-bit)\n\n  // v1 & v6 timestamps are a pain to deal with.  They specify time from the\n  // Gregorian epoch in 100ns intervals, which requires values with 57+ bits of\n  // precision.  But that's outside the precision of IEEE754 floats (i.e. JS\n  // numbers).  To work around this, we represent them internally using 'msecs'\n  // (milliseconds since unix epoch) and 'nsecs' (100-nanoseconds offset from\n  // `msecs`).\n\n  msecs?: number; // timestamp (milliseconds, unix epoch)\n  nsecs?: number; // timestamp (100-nanoseconds offset from 'msecs')\n};\n\nconst _state: V1State = {};\n\nfunction v1(options?: Version1Options, buf?: undefined, offset?: number): string;\nfunction v1<Buf extends Uint8Array = Uint8Array>(\n  options: Version1Options | undefined,\n  buf: Buf,\n  offset?: number\n): Buf;\nfunction v1<TBuf extends Uint8Array = Uint8Array>(\n  options?: Version1Options,\n  buf?: TBuf,\n  offset?: number\n): UUIDTypes<TBuf> {\n  let bytes: Uint8Array;\n\n  // Extract _v6 flag from options, clearing options if appropriate\n  const isV6 = options?._v6 ?? false;\n  if (options) {\n    const optionsKeys = Object.keys(options);\n    if (optionsKeys.length === 1 && optionsKeys[0] === '_v6') {\n      options = undefined;\n    }\n  }\n\n  if (options) {\n    // With options: Make UUID independent of internal state\n    bytes = v1Bytes(\n      options.random ?? options.rng?.() ?? rng(),\n      options.msecs,\n      options.nsecs,\n      options.clockseq,\n      options.node,\n      buf,\n      offset\n    );\n  } else {\n    // Without options: Make UUID from internal state\n    const now = Date.now();\n    const rnds = rng();\n\n    updateV1State(_state, now, rnds);\n\n    // Geenerate UUID.  Note that v6 uses random values for `clockseq` and\n    // `node`.\n    //\n    // https://www.rfc-editor.org/rfc/rfc9562.html#section-5.6-4\n    bytes = v1Bytes(\n      rnds,\n      _state.msecs,\n      _state.nsecs,\n      // v6 UUIDs get random `clockseq` and `node` for every UUID\n      // https://www.rfc-editor.org/rfc/rfc9562.html#section-5.6-4\n      isV6 ? undefined : _state.clockseq,\n      isV6 ? undefined : _state.node,\n      buf,\n      offset\n    );\n  }\n\n  return buf ?? unsafeStringify(bytes);\n}\n\n// (Private!)  Do not use.  This method is only exported for testing purposes\n// and may change without notice.\nexport function updateV1State(state: V1State, now: number, rnds: Uint8Array) {\n  state.msecs ??= -Infinity;\n  state.nsecs ??= 0;\n\n  // Update timestamp\n  if (now === state.msecs) {\n    // Same msec-interval = simulate higher clock resolution by bumping `nsecs`\n    // https://www.rfc-editor.org/rfc/rfc9562.html#section-6.1-2.6\n    state.nsecs++;\n\n    // Check for `nsecs` overflow (nsecs is capped at 10K intervals / msec)\n    if (state.nsecs >= 10000) {\n      // Prior to uuid@11 this would throw an error, however the RFCs allow for\n      // changing the node in this case.  This slightly breaks monotonicity at\n      // msec granularity, but that's not a significant concern.\n      // https://www.rfc-editor.org/rfc/rfc9562.html#section-6.1-2.16\n      state.node = undefined;\n      state.nsecs = 0;\n    }\n  } else if (now > state.msecs) {\n    // Reset nsec counter when clock advances to a new msec interval\n    state.nsecs = 0;\n  } else if (now < state.msecs) {\n    // Handle clock regression\n    // https://www.rfc-editor.org/rfc/rfc9562.html#section-6.1-2.7\n    //\n    // Note: Unsetting node here causes both it and clockseq to be randomized,\n    // below.\n    state.node = undefined;\n  }\n\n  // Init node and clock sequence (do this after timestamp update which may\n  // reset the node) https://www.rfc-editor.org/rfc/rfc9562.html#section-5.1-7\n  //\n  // Note:\n  if (!state.node) {\n    state.node = rnds.slice(10, 16);\n\n    // Set multicast bit\n    // https://www.rfc-editor.org/rfc/rfc9562.html#section-6.10-3\n    state.node[0] |= 0x01; // Set multicast bit\n\n    // Clock sequence must be randomized\n    // https://www.rfc-editor.org/rfc/rfc9562.html#section-5.1-8\n    state.clockseq = ((rnds[8] << 8) | rnds[9]) & 0x3fff;\n  }\n\n  state.msecs = now;\n\n  return state;\n}\n\nfunction v1Bytes(\n  rnds: Uint8Array,\n  msecs?: number,\n  nsecs?: number,\n  clockseq?: number,\n  node?: Uint8Array,\n  buf?: Uint8Array,\n  offset = 0\n) {\n  if (rnds.length < 16) {\n    throw new Error('Random bytes length must be >= 16');\n  }\n\n  // Defaults\n  if (!buf) {\n    buf = new Uint8Array(16);\n    offset = 0;\n  } else {\n    if (offset < 0 || offset + 16 > buf.length) {\n      throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n    }\n  }\n\n  msecs ??= Date.now();\n  nsecs ??= 0;\n  clockseq ??= ((rnds[8] << 8) | rnds[9]) & 0x3fff;\n  node ??= rnds.slice(10, 16);\n\n  // Offset to Gregorian epoch\n  // https://www.rfc-editor.org/rfc/rfc9562.html#section-5.1-1\n  msecs += 12219292800000;\n\n  // `time_low`\n  const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n  buf[offset++] = (tl >>> 24) & 0xff;\n  buf[offset++] = (tl >>> 16) & 0xff;\n  buf[offset++] = (tl >>> 8) & 0xff;\n  buf[offset++] = tl & 0xff;\n\n  // `time_mid`\n  const tmh = ((msecs / 0x100000000) * 10000) & 0xfffffff;\n  buf[offset++] = (tmh >>> 8) & 0xff;\n  buf[offset++] = tmh & 0xff;\n\n  // `time_high_and_version`\n  buf[offset++] = ((tmh >>> 24) & 0xf) | 0x10; // include version\n  buf[offset++] = (tmh >>> 16) & 0xff;\n\n  // `clock_seq_hi_and_reserved` | variant\n  buf[offset++] = (clockseq >>> 8) | 0x80;\n\n  // `clock_seq_low`\n  buf[offset++] = clockseq & 0xff;\n\n  // `node`\n  for (let n = 0; n < 6; ++n) {\n    buf[offset++] = node[n];\n  }\n\n  return buf;\n}\n\nexport default v1;\n"
  },
  {
    "path": "src/v1ToV6.ts",
    "content": "import { UUIDTypes } from './types.js';\nimport parse from './parse.js';\nimport { unsafeStringify } from './stringify.js';\n\n/**\n * Convert a v1 UUID to a v6 UUID\n *\n * @param {string|Uint8Array} uuid - The v1 UUID to convert to v6\n * @returns {string|Uint8Array} The v6 UUID as the same type as the `uuid` arg\n * (string or Uint8Array)\n */\nexport default function v1ToV6(uuid: string): string;\nexport default function v1ToV6(uuid: Uint8Array): Uint8Array;\nexport default function v1ToV6(uuid: string | Uint8Array): UUIDTypes {\n  const v1Bytes = typeof uuid === 'string' ? parse(uuid) : uuid;\n\n  const v6Bytes = _v1ToV6(v1Bytes);\n\n  return typeof uuid === 'string' ? unsafeStringify(v6Bytes) : v6Bytes;\n}\n\n// Do the field transformation needed for v1 -> v6\nfunction _v1ToV6(v1Bytes: Uint8Array) {\n  return Uint8Array.of(\n    ((v1Bytes[6] & 0x0f) << 4) | ((v1Bytes[7] >> 4) & 0x0f),\n    ((v1Bytes[7] & 0x0f) << 4) | ((v1Bytes[4] & 0xf0) >> 4),\n    ((v1Bytes[4] & 0x0f) << 4) | ((v1Bytes[5] & 0xf0) >> 4),\n    ((v1Bytes[5] & 0x0f) << 4) | ((v1Bytes[0] & 0xf0) >> 4),\n\n    ((v1Bytes[0] & 0x0f) << 4) | ((v1Bytes[1] & 0xf0) >> 4),\n    ((v1Bytes[1] & 0x0f) << 4) | ((v1Bytes[2] & 0xf0) >> 4),\n\n    0x60 | (v1Bytes[2] & 0x0f),\n    v1Bytes[3],\n\n    v1Bytes[8],\n    v1Bytes[9],\n    v1Bytes[10],\n    v1Bytes[11],\n    v1Bytes[12],\n    v1Bytes[13],\n    v1Bytes[14],\n    v1Bytes[15]\n  );\n}\n"
  },
  {
    "path": "src/v3.ts",
    "content": "import { UUIDTypes } from './types.js';\nimport md5 from './md5.js';\nimport v35, { DNS, URL } from './v35.js';\n\nexport { DNS, URL } from './v35.js';\n\nfunction v3(\n  value: string | Uint8Array,\n  namespace: UUIDTypes,\n  buf?: undefined,\n  offset?: number\n): string;\nfunction v3<TBuf extends Uint8Array = Uint8Array>(\n  value: string | Uint8Array,\n  namespace: UUIDTypes,\n  buf: TBuf,\n  offset?: number\n): TBuf;\nfunction v3<TBuf extends Uint8Array = Uint8Array>(\n  value: string | Uint8Array,\n  namespace: UUIDTypes,\n  buf?: TBuf,\n  offset?: number\n): UUIDTypes<TBuf> {\n  return v35(0x30, md5, value, namespace, buf, offset);\n}\n\nv3.DNS = DNS;\nv3.URL = URL;\n\nexport default v3;\n"
  },
  {
    "path": "src/v35.ts",
    "content": "import { UUIDTypes } from './types.js';\nimport parse from './parse.js';\nimport { unsafeStringify } from './stringify.js';\n\nexport function stringToBytes(str: string) {\n  // TODO: Use TextEncoder (see https://stackoverflow.com/a/48762658/109538)\n  str = unescape(encodeURIComponent(str));\n\n  const bytes = new Uint8Array(str.length);\n\n  for (let i = 0; i < str.length; ++i) {\n    bytes[i] = str.charCodeAt(i);\n  }\n\n  return bytes;\n}\n\nexport const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexport const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\n\ntype HashFunction = (bytes: Uint8Array) => Uint8Array;\n\nexport default function v35<TBuf extends Uint8Array = Uint8Array>(\n  version: 0x30 | 0x50,\n  hash: HashFunction,\n  value: string | Uint8Array,\n  namespace: UUIDTypes,\n  buf?: TBuf,\n  offset?: number\n): UUIDTypes<TBuf> {\n  const valueBytes: Uint8Array = typeof value === 'string' ? stringToBytes(value) : value;\n  const namespaceBytes: Uint8Array = typeof namespace === 'string' ? parse(namespace) : namespace;\n\n  if (typeof namespace === 'string') {\n    namespace = parse(namespace);\n  }\n\n  if (namespace?.length !== 16) {\n    throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n  }\n\n  // Compute hash of namespace and value, Per 4.3\n  // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n  // hashfunc([...namespace, ... value])`\n  let bytes = new Uint8Array(16 + valueBytes.length);\n  bytes.set(namespaceBytes);\n  bytes.set(valueBytes, namespaceBytes.length);\n  bytes = hash(bytes);\n\n  bytes[6] = (bytes[6] & 0x0f) | version;\n  bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n  if (buf) {\n    offset = offset || 0;\n\n    for (let i = 0; i < 16; ++i) {\n      buf[offset + i] = bytes[i];\n    }\n\n    return buf;\n  }\n\n  return unsafeStringify(bytes);\n}\n"
  },
  {
    "path": "src/v4.ts",
    "content": "import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nimport { UUIDTypes, Version4Options } from './types.js';\n\nfunction _v4<TBuf extends Uint8Array = Uint8Array>(\n  options?: Version4Options,\n  buf?: TBuf,\n  offset?: number\n): UUIDTypes<TBuf> {\n  options = options || {};\n\n  const rnds = options.random ?? options.rng?.() ?? rng();\n  if (rnds.length < 16) {\n    throw new Error('Random bytes length must be >= 16');\n  }\n\n  // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n  rnds[6] = (rnds[6] & 0x0f) | 0x40;\n  rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n  // Copy bytes to buffer, if provided\n  if (buf) {\n    offset = offset || 0;\n    if (offset < 0 || offset + 16 > buf.length) {\n      throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n    }\n\n    for (let i = 0; i < 16; ++i) {\n      buf[offset + i] = rnds[i];\n    }\n\n    return buf;\n  }\n\n  return unsafeStringify(rnds);\n}\n\nfunction v4(options?: Version4Options, buf?: undefined, offset?: number): string;\nfunction v4<TBuf extends Uint8Array = Uint8Array>(\n  options: Version4Options | undefined,\n  buf: TBuf,\n  offset?: number\n): TBuf;\nfunction v4<TBuf extends Uint8Array = Uint8Array>(\n  options?: Version4Options,\n  buf?: TBuf,\n  offset?: number\n): UUIDTypes<TBuf> {\n  if (native.randomUUID && !buf && !options) {\n    return native.randomUUID();\n  }\n\n  // Putting tail-code that could just go inline here in a separate function\n  // allows for compiler optimizations that dramatically improve performance.\n  //\n  // REF: https://github.com/uuidjs/uuid/issues/892\n  return _v4(options, buf, offset);\n}\n\nexport default v4;\n"
  },
  {
    "path": "src/v5.ts",
    "content": "import { UUIDTypes } from './types.js';\nimport sha1 from './sha1.js';\nimport v35, { DNS, URL } from './v35.js';\n\nexport { DNS, URL } from './v35.js';\n\nfunction v5(\n  value: string | Uint8Array,\n  namespace: UUIDTypes,\n  buf?: undefined,\n  offset?: number\n): string;\nfunction v5<TBuf extends Uint8Array = Uint8Array>(\n  value: string | Uint8Array,\n  namespace: UUIDTypes,\n  buf: TBuf,\n  offset?: number\n): TBuf;\nfunction v5<TBuf extends Uint8Array = Uint8Array>(\n  value: string | Uint8Array,\n  namespace: UUIDTypes,\n  buf?: TBuf,\n  offset?: number\n): UUIDTypes<TBuf> {\n  return v35(0x50, sha1, value, namespace, buf, offset);\n}\n\nv5.DNS = DNS;\nv5.URL = URL;\n\nexport default v5;\n"
  },
  {
    "path": "src/v6.ts",
    "content": "import { UUIDTypes, Version6Options } from './types.js';\nimport { unsafeStringify } from './stringify.js';\nimport v1 from './v1.js';\nimport v1ToV6 from './v1ToV6.js';\n\nfunction v6(options?: Version6Options, buf?: undefined, offset?: number): string;\nfunction v6<TBuf extends Uint8Array = Uint8Array>(\n  options: Version6Options | undefined,\n  buf: TBuf,\n  offset?: number\n): TBuf;\nfunction v6<TBuf extends Uint8Array = Uint8Array>(\n  options?: Version6Options,\n  buf?: TBuf,\n  offset?: number\n): UUIDTypes<TBuf> {\n  options ??= {};\n  offset ??= 0;\n\n  // v6 is v1 with different field layout, so we start with a v1 UUID, albeit\n  // with slightly different behavior around how the clock_seq and node fields\n  // are randomized, which is why we call v1 with _v6: true.\n  let bytes = v1({ ...options, _v6: true }, new Uint8Array(16));\n\n  // Reorder the fields to v6 layout.\n  bytes = v1ToV6(bytes);\n\n  // Return as a byte array if requested\n  if (buf) {\n    for (let i = 0; i < 16; i++) {\n      buf[offset + i] = bytes[i];\n    }\n    return buf;\n  }\n\n  return unsafeStringify(bytes);\n}\n\nexport default v6;\n"
  },
  {
    "path": "src/v6ToV1.ts",
    "content": "import { UUIDTypes } from './types.js';\nimport parse from './parse.js';\nimport { unsafeStringify } from './stringify.js';\n\n/**\n * Convert a v6 UUID to a v1 UUID\n *\n * @param {string|Uint8Array} uuid - The v6 UUID to convert to v6\n * @returns {string|Uint8Array} The v1 UUID as the same type as the `uuid` arg\n * (string or Uint8Array)\n */\nexport default function v6ToV1(uuid: string): string;\nexport default function v6ToV1(uuid: Uint8Array): Uint8Array;\nexport default function v6ToV1(uuid: UUIDTypes): UUIDTypes {\n  const v6Bytes = typeof uuid === 'string' ? parse(uuid) : uuid;\n\n  const v1Bytes = _v6ToV1(v6Bytes);\n\n  return typeof uuid === 'string' ? unsafeStringify(v1Bytes) : v1Bytes;\n}\n\n// Do the field transformation needed for v6 -> v1\nfunction _v6ToV1(v6Bytes: Uint8Array) {\n  return Uint8Array.of(\n    ((v6Bytes[3] & 0x0f) << 4) | ((v6Bytes[4] >> 4) & 0x0f),\n    ((v6Bytes[4] & 0x0f) << 4) | ((v6Bytes[5] & 0xf0) >> 4),\n    ((v6Bytes[5] & 0x0f) << 4) | (v6Bytes[6] & 0x0f),\n    v6Bytes[7],\n\n    ((v6Bytes[1] & 0x0f) << 4) | ((v6Bytes[2] & 0xf0) >> 4),\n    ((v6Bytes[2] & 0x0f) << 4) | ((v6Bytes[3] & 0xf0) >> 4),\n\n    0x10 | ((v6Bytes[0] & 0xf0) >> 4),\n    ((v6Bytes[0] & 0x0f) << 4) | ((v6Bytes[1] & 0xf0) >> 4),\n\n    v6Bytes[8],\n    v6Bytes[9],\n    v6Bytes[10],\n    v6Bytes[11],\n    v6Bytes[12],\n    v6Bytes[13],\n    v6Bytes[14],\n    v6Bytes[15]\n  );\n}\n"
  },
  {
    "path": "src/v7.ts",
    "content": "import rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nimport { UUIDTypes, Version7Options } from './types.js';\n\ntype V7State = {\n  msecs?: number; // time, milliseconds\n  seq?: number; // sequence number (32-bits)\n};\n\nconst _state: V7State = {};\n\nfunction v7(options?: Version7Options, buf?: undefined, offset?: number): string;\nfunction v7<TBuf extends Uint8Array = Uint8Array>(\n  options: Version7Options | undefined,\n  buf: TBuf,\n  offset?: number\n): TBuf;\nfunction v7<TBuf extends Uint8Array = Uint8Array>(\n  options?: Version7Options,\n  buf?: TBuf,\n  offset?: number\n): UUIDTypes<TBuf> {\n  let bytes: Uint8Array;\n\n  if (options) {\n    // With options: Make UUID independent of internal state\n    bytes = v7Bytes(\n      options.random ?? options.rng?.() ?? rng(),\n      options.msecs,\n      options.seq,\n      buf,\n      offset\n    );\n  } else {\n    // No options: Use internal state\n    const now = Date.now();\n    const rnds = rng();\n\n    updateV7State(_state, now, rnds);\n\n    bytes = v7Bytes(rnds, _state.msecs, _state.seq, buf, offset);\n  }\n\n  return buf ?? unsafeStringify(bytes);\n}\n\n// (Private!)  Do not use.  This method is only exported for testing purposes\n// and may change without notice.\nexport function updateV7State(state: V7State, now: number, rnds: Uint8Array) {\n  state.msecs ??= -Infinity;\n  state.seq ??= 0;\n\n  if (now > state.msecs) {\n    // Time has moved on! Pick a new random sequence number\n    state.seq = (rnds[6] << 23) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];\n    state.msecs = now;\n  } else {\n    // Bump sequence counter w/ 32-bit rollover\n    state.seq = (state.seq + 1) | 0;\n\n    // In case of rollover, bump timestamp to preserve monotonicity. This is\n    // allowed by the RFC and should self-correct as the system clock catches\n    // up. See https://www.rfc-editor.org/rfc/rfc9562.html#section-6.2-9.4\n    if (state.seq === 0) {\n      state.msecs++;\n    }\n  }\n\n  return state;\n}\n\nfunction v7Bytes(rnds: Uint8Array, msecs?: number, seq?: number, buf?: Uint8Array, offset = 0) {\n  if (rnds.length < 16) {\n    throw new Error('Random bytes length must be >= 16');\n  }\n\n  if (!buf) {\n    buf = new Uint8Array(16);\n    offset = 0;\n  } else {\n    if (offset < 0 || offset + 16 > buf.length) {\n      throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n    }\n  }\n\n  // Defaults\n  msecs ??= Date.now();\n  seq ??= ((rnds[6] * 0x7f) << 24) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];\n\n  // byte 0-5: timestamp (48 bits)\n  buf[offset++] = (msecs / 0x10000000000) & 0xff;\n  buf[offset++] = (msecs / 0x100000000) & 0xff;\n  buf[offset++] = (msecs / 0x1000000) & 0xff;\n  buf[offset++] = (msecs / 0x10000) & 0xff;\n  buf[offset++] = (msecs / 0x100) & 0xff;\n  buf[offset++] = msecs & 0xff;\n\n  // byte 6: `version` (4 bits) | sequence bits 28-31 (4 bits)\n  buf[offset++] = 0x70 | ((seq >>> 28) & 0x0f);\n\n  // byte 7: sequence bits 20-27 (8 bits)\n  buf[offset++] = (seq >>> 20) & 0xff;\n\n  // byte 8: `variant` (2 bits) | sequence bits 14-19 (6 bits)\n  buf[offset++] = 0x80 | ((seq >>> 14) & 0x3f);\n\n  // byte 9: sequence bits 6-13 (8 bits)\n  buf[offset++] = (seq >>> 6) & 0xff;\n\n  // byte 10: sequence bits 0-5 (6 bits) | random (2 bits)\n  buf[offset++] = ((seq << 2) & 0xff) | (rnds[10] & 0x03);\n\n  // bytes 11-15: random (40 bits)\n  buf[offset++] = rnds[11];\n  buf[offset++] = rnds[12];\n  buf[offset++] = rnds[13];\n  buf[offset++] = rnds[14];\n  buf[offset++] = rnds[15];\n\n  return buf;\n}\n\nexport default v7;\n"
  },
  {
    "path": "src/validate.ts",
    "content": "import REGEX from './regex.js';\n\nfunction validate(uuid: unknown) {\n  return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;\n"
  },
  {
    "path": "src/version.ts",
    "content": "import validate from './validate.js';\n\nfunction version(uuid: string) {\n  if (!validate(uuid)) {\n    throw TypeError('Invalid UUID');\n  }\n\n  return parseInt(uuid.slice(14, 15), 16);\n}\n\nexport default version;\n"
  },
  {
    "path": "test/browser/browser.spec.js",
    "content": "/* global browser:false, $:false, $$:false */\n\nconst v1Regex = /^[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;\nconst v4Regex = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;\nconst v6Regex = /^[0-9A-F]{8}-[0-9A-F]{4}-6[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;\nconst v7Regex = /^[0-9A-F]{8}-[0-9A-F]{4}-7[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;\n\nconst V1_ID = 'f1207660-21d2-11ef-8c4f-419efbd44d48';\nconst V6_ID = '1ef21d2f-1207-6660-8c4f-419efbd44d48';\n\nconst v1 = (result) => expect(result).toMatch(v1Regex);\nconst v4 = (result) => expect(result).toMatch(v4Regex);\nconst v6 = (result) => expect(result).toMatch(v6Regex);\nconst v7 = (result) => expect(result).toMatch(v7Regex);\nconst v3dns = (result) => expect(result).toBe('9125a8dc-52ee-365b-a5aa-81b0b3681cf6');\nconst v3url = (result) => expect(result).toBe('c6235813-3ba4-3801-ae84-e0a6ebb7d138');\nconst v3custom = (result) => expect(result).toBe('f5a52d34-dcd7-30f7-b581-0112fab43d0c');\nconst v5dns = (result) => expect(result).toBe('fdda765f-fc57-5604-a269-52a7df8164ec');\nconst v5url = (result) => expect(result).toBe('3bbcee75-cecc-5b56-8031-b6641c1ed1f1');\nconst v5custom = (result) => expect(result).toBe('c49c5142-4d9a-5940-a926-612ede0ec632');\n\nconst v1ToV6 = (result) => expect(result).toBe(V6_ID);\nconst v6ToV1 = (result) => expect(result).toBe(V1_ID);\n\nconst nil = (result) => expect(result).toBe('00000000-0000-0000-0000-000000000000');\nconst max = (result) => expect(result).toBe('ffffffff-ffff-ffff-ffff-ffffffffffff');\nconst parse = (result) =>\n  expect(result).toEqual('85,35,141,21,201,38,69,152,180,157,207,78,145,59,161,60');\nconst stringify = (result) => expect(result).toBe('55238d15-c926-4598-b49d-cf4e913ba13c');\nconst validate = (result) => expect(result).toBe('true');\nconst version = (result) => expect(result).toBe('4');\n\nconst expectations = {\n  'uuidv1()': v1,\n  'uuidv4()': v4,\n  'uuidv7()': v7,\n  'uuidv3() DNS': v3dns,\n  'uuidv3() URL': v3url,\n  'uuidv3() MY_NAMESPACE': v3custom,\n  'uuidv5() DNS': v5dns,\n  'uuidv5() URL': v5url,\n  'uuidv5() MY_NAMESPACE': v5custom,\n  'uuidv6()': v6,\n\n  'uuidv1ToV6()': v1ToV6,\n  'uuidv6ToV1()': v6ToV1,\n\n  NIL_UUID: nil,\n  MAX_UUID: max,\n  'uuidParse()': parse,\n  'uuidStringify()': stringify,\n  'uuidValidate()': validate,\n  'uuidVersion()': version,\n\n  'uuid.v1()': v1,\n  'uuid.v4()': v4,\n  'uuid.v7()': v7,\n  'uuid.v3() DNS': v3dns,\n  'uuid.v3() URL': v3url,\n  'uuid.v3() MY_NAMESPACE': v3custom,\n  'uuid.v5() DNS': v5dns,\n  'uuid.v5() URL': v5url,\n  'uuid.v5() MY_NAMESPACE': v5custom,\n  'uuid.v6()': v6,\n\n  'uuid.v1ToV6()': v1ToV6,\n  'uuid.v6ToV1()': v6ToV1,\n\n  'uuid.NIL': nil,\n  'uuid.MAX': max,\n  'uuid.parse()': parse,\n  'uuid.stringify()': stringify,\n  'uuid.validate()': validate,\n  'uuid.version()': version,\n};\nconst expectationTitles = Object.keys(expectations);\n\nconst PORT = 9000;\n\ndescribe('BrowserStack Local Testing', () => {\n  async function testExpectations(path, titleFilter) {\n    const url = `http://127.0.0.1:${PORT}/${path}`;\n    await browser.url(url);\n\n    await browser.waitUntil(async () => $('#done').isExisting(), 30000);\n\n    const elements = await $$('.test_result');\n\n    // Unfortunately the WebDriver API is not thread safe and we cannot use Promise.all() to\n    // query it in parallel:\n    // https://github.com/SeleniumHQ/selenium/issues/422#issuecomment-90629726\n    const titles = [];\n\n    for (let i = 0; i < elements.length; ++i) {\n      const element = elements[i];\n      const titleEl = await element.$('dt');\n      const title = await titleEl.getText();\n      const resultEl = await element.$('dd');\n      const result = await resultEl.getText();\n\n      if (!expectations[title]) {\n        throw new Error(`Unexpected title: ${title}`);\n      }\n\n      expectations[title](result);\n      titles.push(title);\n    }\n\n    // Confirm the expected titles are all present\n    const expectedTitles = expectationTitles.filter(titleFilter);\n    expect(titles.length).toEqual(expectedTitles.length);\n    expect(titles.sort()).toEqual(expectedTitles.sort());\n  }\n\n  describe('webpack', () => {\n    it('renders all', async () => testExpectations('browser-webpack/example-all.html', () => true));\n\n    it('renders v1 only', async () =>\n      testExpectations('browser-webpack/example-v1.html', (title) => title.includes('uuidv1()')));\n\n    it('renders v4 only', async () =>\n      testExpectations('browser-webpack/example-v4.html', (title) => title.includes('uuidv4()')));\n  });\n\n  describe('rollup', () => {\n    it('renders all', async () => testExpectations('browser-rollup/example-all.html', () => true));\n\n    it('renders v1 only', async () =>\n      testExpectations('browser-rollup/example-v1.html', (title) => title.includes('uuidv1()')));\n\n    it('renders v4 only', async () =>\n      testExpectations('browser-rollup/example-v4.html', (title) => title.includes('uuidv4(')));\n  });\n});\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"declaration\": true,\n    \"module\": \"NodeNext\",\n    \"moduleResolution\": \"NodeNext\",\n    \"outDir\": \"./dist\",\n    \"removeComments\": true,\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"target\": \"ES2022\"\n  },\n  \"exclude\": [\"dist\", \"examples\"]\n}\n"
  },
  {
    "path": "wdio.conf.js",
    "content": "const PORT = 9000;\nconst PROJECT = process.env.GITHUB_REPOSITORY || 'node-uuid';\nconst GITHUB_SHA = process.env.GITHUB_SHA || '';\nconst GITHUB_REF = process.env.GITHUB_REF || '';\nconst BUILD = GITHUB_SHA || GITHUB_REF ? `${GITHUB_REF} ${GITHUB_SHA}` : 'manual build';\n\nconst commonCapabilities = {\n  projectName: PROJECT,\n  buildName: BUILD,\n  sessionName: 'browser test',\n  resolution: '1024x768',\n};\n\nconst capabilities = [\n  // Chrome Latest\n  {\n    browserName: 'Chrome',\n    browserVersion: 'latest',\n\n    'bstack:options': {\n      ...commonCapabilities,\n      os: 'Windows',\n      osVersion: '11',\n    },\n  },\n\n  // Firefox Latest\n  {\n    browserName: 'Firefox',\n    browserVersion: 'latest',\n\n    'bstack:options': {\n      ...commonCapabilities,\n      os: 'Windows',\n      osVersion: '11',\n    },\n  },\n\n  // Edge Latest\n  {\n    browserName: 'Edge',\n    browserVersion: 'latest',\n\n    'bstack:options': {\n      ...commonCapabilities,\n      os: 'Windows',\n      osVersion: '11',\n    },\n  },\n\n  // Safari Latest\n  {\n    browserName: 'Safari',\n    browserVersion: 'latest',\n\n    'bstack:options': {\n      ...commonCapabilities,\n      os: 'OS X',\n      osVersion: 'Monterey',\n    },\n  },\n];\n\nexport const config = {\n  specs: ['./test/browser/browser.spec.js'],\n\n  user: process.env.BROWSERSTACK_USER,\n  key: process.env.BROWSERSTACK_ACCESS_KEY,\n\n  services: [\n    [\n      'static-server',\n      {\n        folders: [{ mount: '/', path: './examples' }],\n        port: PORT,\n      },\n    ],\n    [\n      'browserstack',\n      {\n        browserstackLocal: true,\n      },\n    ],\n  ],\n\n  runner: 'local',\n  maxInstances: 5,\n\n  capabilities,\n\n  logLevel: 'warn',\n  bail: 1,\n  waitforTimeout: 10000,\n  connectionRetryTimeout: 90000,\n  connectionRetryCount: 3,\n  framework: 'jasmine',\n  jasmineOpts: {\n    defaultTimeoutInterval: 120000,\n  },\n  reporters: ['spec'],\n};\n"
  }
]